Thursday, February 25, 2010

Lazy list division (Haskell)


firstHalf :: [a] -> [a]
firstHalf list0 = div list0 list0
where
div (a,b:arg) (r:res) = r:div arg res
div _ _ = []