[ create a new paste ] login | about

Link: http://codepad.org/KHd73y9L    [ raw code | output | fork ]

Haskell, pasted on Nov 26:
1
2
3
4
5
6
7
8
f :: Int -> [Int] -> [Int]
f n [] = []
f n arr
  | tail arr  == [] = arr
  | otherwise       = replicate n (head arr) ++ f n (tail arr)

main = getContents >>=
       mapM_ print. (\(n:arr) -> f n arr). map read. words


Output:
1
2

Program error: pattern match failure: main_v3585 []


Create a new paste based on this one


Comments: