about summary refs log tree commit diff stats
path: root/shell/data.limg
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2021-06-06 12:55:06 -0700
committerKartik K. Agaram <vc@akkartik.com>2021-06-06 12:55:06 -0700
commitc1fff5ec143a3fb658357ec3f312ca7fcd40ef01 (patch)
treebb31c9733846221e263969cede95ead4a180656e /shell/data.limg
parent44c53fa5720ce1548224e3beeedd7b0c491aa2fc (diff)
downloadmu-c1fff5ec143a3fb658357ec3f312ca7fcd40ef01.tar.gz
shell: fleshing out the 'standard library'
Based loosely on Arc's arc.arc:
  http://arclanguage.org
  https://github.com/arclanguage/anarki/blob/official/arc.arc
Diffstat (limited to 'shell/data.limg')
-rw-r--r--shell/data.limg10
1 files changed, 10 insertions, 0 deletions
diff --git a/shell/data.limg b/shell/data.limg
index fac0e683..c85dd050 100644
--- a/shell/data.limg
+++ b/shell/data.limg
@@ -5,6 +5,16 @@
     (def . [(mac (def (name . params) . body)
   `(define ,name (fn ,params ,@body)))])
     (do . [(mac (do . body) `((fn () ,@body)))])
+    (list . [(def (list . args) args)])
+    (len . [(def (len l)
+  (if (no l)
+    0
+    (+ 1 (len (cdr l)))))])
+    (map1 . [(def (map1 f xs)
+  (if (no xs)
+    ()
+    (cons (f (car xs))
+          (map1 f (cdr xs)))))])
     (let . [(mac (let var val . body)
   `((fn (,var) ,@body) ,val))])
     (when . [(mac (when cond . body)