@ -228,11 +228,3 @@ var cdr = builtin{
return s.items[1:], nil
},
}
var names = builtin{
name: "names",
arity: 0,
fn: func(vals []interface{}) (interface{}, error) {
return universe.keys(), nil
@ -46,6 +46,9 @@ func (e environment) keys() []string {
for key, _ := range e.items {
keys = append(keys, string(key))
if e.outer != nil {
keys = append(keys, e.outer.keys()...)
sort.Strings(keys)
return keys
@ -272,3 +272,12 @@ var begin = special{
return v, nil
var names = special{
variadic: false,
fn: func(env *environment, args []interface{}) (interface{}, error) {
return env.keys(), nil