Monthly Archives: January 2013

Haskell DList

Append operation in haskell might be costlier ,if done this way let x = “hello” ++ ” haskell” let y = x ++ ” well done ” to append this way have to traverse whole list each time ,a better … Continue reading

Posted in Uncategorized | Leave a comment

Haskell foldr in terms of foldl

This explains foldl in terms of foldr : https://ratndeo.wordpress.com/2013/01/11/haskell-foldl-as-foldr/ Now its time to whisper foldr in terms of foldl : foldr :: (a -> b -> b) -> b -> [a] -> b foldr f init (x:xs) = foldl f’ … Continue reading

Posted in Uncategorized | Leave a comment

Haskell foldl as foldr

foldl :: (a -> b -> a) -> a -> [b] -> a foldl f init xs = foldr f’ id xs init where f’ x g z = g ( f z x ) at first definition of f’ … Continue reading

Posted in Uncategorized | 1 Comment

Haskell map fxn as foldr

Standard haskell map fxn def : map’ mapper [] = [] map’ mapper (x:xs) = mapper x : map’ mapper xs same map as in terms of foldr : map” mapper = foldr (\x y -> mapper x : y … Continue reading

Posted in Uncategorized | Leave a comment