Skip to content

Instantly share code, notes, and snippets.

@ap
Created July 23, 2009 04:27
Show Gist options
  • Save ap/152462 to your computer and use it in GitHub Desktop.
Save ap/152462 to your computer and use it in GitHub Desktop.
My first Haskell code
-- http://thedailywtf.com/Articles/Programming-Praxis-Russian-Peasant-Multiplication.aspx
foldl1 (+) . map (snd) . filter (odd . fst) . takeWhile ((0 <) . fst) $ iterate (\(x,y) -> (x`div`2, y*2)) (18,23)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment