Skip to content

Commit

Permalink
New example: EvenDouble in the generator style, rathen than as a tail…
Browse files Browse the repository at this point in the history
… recursive function (so we get fusion)
  • Loading branch information
batterseapower committed Jul 19, 2010
1 parent e1a8ae8 commit 3380c4b
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
13 changes: 13 additions & 0 deletions examples/toys/EvenDoubleGenerator.core
@@ -0,0 +1,13 @@
double y = case y of Z -> Z
S x -> S (S (double x))

even y = case y of Z -> True
S z -> case z of Z -> False
S x -> even x

root x = even (double x)

tests = [
(root Z, True),
(root (S Z), True)
]
1 change: 1 addition & 0 deletions examples/toys/EvenDoubleGenerator.hs
@@ -0,0 +1 @@
data Nat = Z | S Nat

0 comments on commit 3380c4b

Please sign in to comment.