diff options
author | Kartik K. Agaram <vc@akkartik.com> | 2021-06-06 12:55:06 -0700 |
---|---|---|
committer | Kartik K. Agaram <vc@akkartik.com> | 2021-06-06 12:55:06 -0700 |
commit | c1fff5ec143a3fb658357ec3f312ca7fcd40ef01 (patch) | |
tree | bb31c9733846221e263969cede95ead4a180656e | |
parent | 44c53fa5720ce1548224e3beeedd7b0c491aa2fc (diff) | |
download | mu-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
-rw-r--r-- | shell/data.limg | 10 | ||||
-rw-r--r-- | shell/global.mu | 2 |
2 files changed, 11 insertions, 1 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) diff --git a/shell/global.mu b/shell/global.mu index b4641c60..4a3456bd 100644 --- a/shell/global.mu +++ b/shell/global.mu @@ -19,7 +19,7 @@ fn initialize-globals _self: (addr global-table) { return } var data-ah/eax: (addr handle array global) <- get self, data - populate data-ah, 0x40 + populate data-ah, 0x80 initialize-primitives self } |