카테고리 없음

haskell

루트노드 2016. 9. 5. 19:36

rept :: Int -> a -> [a]
rept 0 i = []
rept n i = i:rept (n-1) i

(##) :: [a] -> Int -> a
(x:xs) ## 0 = x
(x:xs) ## n = xs ## (n-1)

zp :: [a] -> [b] -> [(a,b)]
zp [] y = []
zp x [] = []
zp (x:xs) (y:ys) = (x,y):zp xs ys