Skip to content

Instantly share code, notes, and snippets.

@fumieval
Created July 9, 2012 23:30
Show Gist options
  • Save fumieval/3079775 to your computer and use it in GitHub Desktop.
Save fumieval/3079775 to your computer and use it in GitHub Desktop.
from Prelude import cons
from Prelude import pattern
fact = pattern.build(("0", lambda: 1),
("n", lambda n: n * fact(n - 1)))
map_ = pattern.build(("_ []", lambda: []),
("f (x:xs)", lambda f x xs: cons(f(x), map_(f, xs))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment