aboutsummaryrefslogtreecommitdiff
path: root/src/example/test1.lang
diff options
context:
space:
mode:
authorEduardo Julian2014-11-26 19:26:22 -0400
committerEduardo Julian2014-11-26 19:26:22 -0400
commita96bb768a5f02c2dc9c0de1e50dc14376d2e7f35 (patch)
tree2387d0bf4cf171475f0f564c9006e0546bac48e3 /src/example/test1.lang
parent5bf50ef978eb88e2e61c40f3bb0fea523115e770 (diff)
+ Can now define functions.
% However, they currently access Clojure's environment, instead of the interpreter's.
Diffstat (limited to '')
-rw-r--r--src/example/test1.lang9
1 files changed, 6 insertions, 3 deletions
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)