Skip to content

Instantly share code, notes, and snippets.

@jutememo
Created May 5, 2011 03:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jutememo/956504 to your computer and use it in GitHub Desktop.
Save jutememo/956504 to your computer and use it in GitHub Desktop.
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