プログラミング・パラダイム(2016 年度)テスト解答例(一部)


(1)
  foo []     = True
  foo (x:xs) = x `mod` 5 == 0 && foo xs
(2)
  bar n = [ (i,j) | i <- [0..n], j <- [0..i * i], (i + j) `mod` 2 == 1 ]

(1) [1,2,1,2,3,1,2,3,4,1]
(2) [(2,5),(2,7),(3,7)]