aboutsummaryrefslogtreecommitdiffstats
path: root/examples
diff options
context:
space:
mode:
authorJan Tuomi <jan.tuomi@valuemotive.com>2022-09-24 15:59:16 +0300
committerJan Tuomi <jans.tuomi@gmail.com>2022-12-05 14:21:53 +0200
commit70468c0217e70858bfa037ad81ce8caf1b582ec2 (patch)
treed2f4a948b59e5236f59d5c480d1bf2db07ae2b76 /examples
parentaec05f8d92a608f0fb34fd2453a647b43dcb777d (diff)
Implement let
Diffstat (limited to 'examples')
-rw-r--r--examples/spec.lisp2
-rw-r--r--examples/test.lisp26
2 files changed, 16 insertions, 12 deletions
diff --git a/examples/spec.lisp b/examples/spec.lisp
index 2d870a3..4f4d303 100644
--- a/examples/spec.lisp
+++ b/examples/spec.lisp
@@ -65,7 +65,7 @@
(let map (\[f lst]
(match lst
[] []
- (prep (f head lst) (map f (tail lst))))))
+ (prepend (f head lst) (map f (tail lst))))))
(print!
(map (sum2 1) [1 2 3]))
diff --git a/examples/test.lisp b/examples/test.lisp
index b41007d..3b9fa5e 100644
--- a/examples/test.lisp
+++ b/examples/test.lisp
@@ -1,11 +1,15 @@
-(sum2 1 (
- sum2 2 3
-)) ; test1
-;; (sum2 ; test2
-;; 1
-;; 2 )
-;; "string with space"
-;; "another \n\"string\""
-;; (let id
-;; (\[a] a))
-(\[x] (\[y] (sum2 x y))) \ No newline at end of file
+;; (let map (\[f lst]
+;; (match lst
+;; [] []
+;; (prepend (f head lst) (map f (tail lst))))))
+
+;; (map (+ 1) [1 2 3])
+
+(let mapinc (\[vec]
+ (match vec
+ [] []
+ (prepend
+ (+ 1 (head vec))
+ (mapinc (tail vec))))))
+(env)
+(mapinc [1 2 3])