about summary refs log tree commit diff stats
path: root/shell/data.limg
diff options
context:
space:
mode:
Diffstat (limited to 'shell/data.limg')
-rw-r--r--shell/data.limg13
1 files changed, 12 insertions, 1 deletions
diff --git a/shell/data.limg b/shell/data.limg
index 31510aef..3c1656dc 100644
--- a/shell/data.limg
+++ b/shell/data.limg
@@ -35,7 +35,7 @@
           (map1 f (cdr xs)))])
     (compose . [def (compose f g)
   (fn args
-    (f (g args)))])
+    (f (apply g args)))])
     (some . [def (some f xs)
   if (no xs)
     ()
@@ -55,6 +55,17 @@
     if (= x (car xs))
       1
       (find x (cdr xs))])
+    (pair . [def (pair xs)
+  if (no xs)
+    ()
+    if (no (cdr xs))
+      (list (list (car xs)))
+      (cons (list (car xs) (car (cdr xs)))
+            (pair (cdr (cdr xs))))])
+    (with . [mac (with vars_vals . body)
+  `((fn ,(map1 car (pair vars_vals))
+      ,@body)
+    ,@(map1 (compose car cdr) (pair vars_vals)))])
     (afn . [mac (afn params . body)
   `(let self ()
      (set self (fn ,params ,@body)))])