Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

New example: EvenDouble in the generator style, rathen than as a tail…

… recursive function (so we get fusion)
  • Loading branch information...
commit 3380c4be6a67c6c7d6fd84103afd0e1fd7d2fa54 1 parent e1a8ae8
Max Bolingbroke authored
13 examples/toys/EvenDoubleGenerator.core
View
@@ -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  examples/toys/EvenDoubleGenerator.hs
View
@@ -0,0 +1 @@
+data Nat = Z | S Nat
Please sign in to comment.
Something went wrong with that request. Please try again.