Skip to content

Instantly share code, notes, and snippets.

@jutememo jutememo/foldr3.hs
Created May 5, 2011

Embed
What would you like to do?
foldr3 _ z [] k = k z
foldr3 f_cps z (x:xs ) k = f_cps x (foldr3 f_cps z xs k) $ \y -> k y
main = do print $ foldr3 (\x y k -> k $ x + y) 0 [1..3] id
print $ foldr3 (\x y k -> k $ x + y) 0 [1..3] (* 2)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.