diff --git a/proc.go b/proc.go index 0986ceb..aae46ef 100644 --- a/proc.go +++ b/proc.go @@ -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 +} diff --git a/skeam.go b/skeam.go index 4f29889..33d4fcd 100644 --- a/skeam.go +++ b/skeam.go @@ -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),