|
|
@ -21,18 +21,24 @@ func (s sexp) String() string {
|
|
|
|
type symbol string
|
|
|
|
type symbol string
|
|
|
|
|
|
|
|
|
|
|
|
var universe = &environment{map[symbol]interface{}{
|
|
|
|
var universe = &environment{map[symbol]interface{}{
|
|
|
|
"#t": true,
|
|
|
|
// predefined values
|
|
|
|
"#f": false,
|
|
|
|
"#t": true,
|
|
|
|
"null": nil,
|
|
|
|
"#f": false,
|
|
|
|
"+": builtin(addition),
|
|
|
|
"null": nil,
|
|
|
|
"-": builtin(subtraction),
|
|
|
|
|
|
|
|
"*": builtin(multiplication),
|
|
|
|
// builtin functions
|
|
|
|
"/": builtin(division),
|
|
|
|
"+": builtin(addition),
|
|
|
|
"length": builtin(length),
|
|
|
|
"-": builtin(subtraction),
|
|
|
|
"list": builtin(list),
|
|
|
|
"*": builtin(multiplication),
|
|
|
|
"list?": builtin(islist),
|
|
|
|
"/": builtin(division),
|
|
|
|
"not": builtin(not),
|
|
|
|
"length": builtin(length),
|
|
|
|
"null?": builtin(isnull),
|
|
|
|
"list": builtin(list),
|
|
|
|
|
|
|
|
"list?": builtin(islist),
|
|
|
|
|
|
|
|
"not": builtin(not),
|
|
|
|
|
|
|
|
"null?": builtin(isnull),
|
|
|
|
|
|
|
|
"symbol?": builtin(issymbol),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// special forms
|
|
|
|
"begin": special(begin),
|
|
|
|
"begin": special(begin),
|
|
|
|
"define": special(define),
|
|
|
|
"define": special(define),
|
|
|
|
"if": special(_if),
|
|
|
|
"if": special(_if),
|
|
|
|