added "list?" builtin

master
Jordan Orelli 12 years ago
parent 7ec2538005
commit 86c288d116

@ -110,3 +110,12 @@ func length(vals []interface{}) (interface{}, error) {
func list(vals []interface{}) (interface{}, error) {
return sexp(vals), nil
}
func islist(vals []interface{}) (interface{}, error) {
if err := checkArity(1, vals, "list?"); err != nil {
return nil, err
}
_, ok := vals[0].(sexp)
return ok, nil
}

@ -29,6 +29,7 @@ var universe = &environment{map[symbol]interface{}{
"/": builtin(division),
"length": builtin(length),
"list": builtin(list),
"list?": builtin(islist),
"not": builtin(not),
"begin": special(begin),
"define": special(define),

Loading…
Cancel
Save