diff options
Diffstat (limited to 'shell/data.limg')
-rw-r--r-- | shell/data.limg | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/shell/data.limg b/shell/data.limg index e2e4923b..72eba040 100644 --- a/shell/data.limg +++ b/shell/data.limg @@ -38,6 +38,10 @@ (compose . [def (compose f g) (fn args (f (apply g args)))]) + (caar . [define caar (compose car car)]) + (cadr . [define cadr (compose car cdr)]) + (cddr . [define cddr (compose cdr cdr)]) + (cdar . [define cdar (compose cdr car)]) (some . [def (some f xs) if (no xs) () @@ -62,12 +66,12 @@ () if (no (cdr xs)) (list (list (car xs))) - (cons (list (car xs) (car (cdr xs))) - (pair (cdr (cdr xs))))]) + (cons (list (car xs) (cadr xs)) + (pair (cddr xs)))]) (with . [mac (with vars_vals . body) `((fn ,(map1 car (pair vars_vals)) ,@body) - ,@(map1 (compose car cdr) (pair vars_vals)))]) + ,@(map1 cadr (pair vars_vals)))]) (afn . [mac (afn params . body) `(let self () (set self (fn ,params ,@body)))]) |