From a96bb768a5f02c2dc9c0de1e50dc14376d2e7f35 Mon Sep 17 00:00:00 2001 From: Eduardo Julian Date: Wed, 26 Nov 2014 19:26:22 -0400 Subject: + Can now define functions. % However, they currently access Clojure's environment, instead of the interpreter's. --- src/example/test1.lang | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'src/example') diff --git a/src/example/test1.lang b/src/example/test1.lang index f6f244a57..da3d3fa87 100644 --- a/src/example/test1.lang +++ b/src/example/test1.lang @@ -1,6 +1,9 @@ (* 5 6) -(defdata (List x) - (#Nil []) - (#Cons [x] (List x))) +(def (repeat n val) + (if (<=' n 0) + (#Nil []) + (#Cons [val (repeat (-' n 1) val)]))) + +(repeat 5 5) -- cgit v1.2.3