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
This commit is contained in:
Kartik K. Agaram 2021-06-06 12:55:06 -07:00
parent 44c53fa572
commit c1fff5ec14
2 changed files with 11 additions and 1 deletions

View File

@ -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)

View File

@ -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
}