From 2f1fd4e22a54da905612cdfcedff41bf148f18c8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Glen=20M=C3=A9vel?= Date: Fri, 16 Feb 2018 17:31:08 +0100 Subject: [PATCH] if_fib: tests [if] and [let rec] --- if_fib.exp | 1 + if_fib.lambda | 10 ++++++++++ 2 files changed, 11 insertions(+) create mode 100644 if_fib.exp create mode 100644 if_fib.lambda diff --git a/if_fib.exp b/if_fib.exp new file mode 100644 index 0000000..c3f407c --- /dev/null +++ b/if_fib.exp @@ -0,0 +1 @@ +55 diff --git a/if_fib.lambda b/if_fib.lambda new file mode 100644 index 0000000..3d179a0 --- /dev/null +++ b/if_fib.lambda @@ -0,0 +1,10 @@ +let rec fib = fun n -> + ifzero n then + 0 + else ifzero (n-1) then + 1 + else + fib (n-1) + fib (n-2) +in + +print (fib 10)