From 70468c0217e70858bfa037ad81ce8caf1b582ec2 Mon Sep 17 00:00:00 2001 From: Jan Tuomi Date: Sat, 24 Sep 2022 15:59:16 +0300 Subject: Implement let --- examples/spec.lisp | 2 +- examples/test.lisp | 26 +++++++++++++++----------- 2 files changed, 16 insertions(+), 12 deletions(-) (limited to 'examples') 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]) -- cgit v1.3