diff --git a/evaluator/builtins.go b/evaluator/builtins.go index 064c580..21dd659 100644 --- a/evaluator/builtins.go +++ b/evaluator/builtins.go @@ -1,6 +1,9 @@ package evaluator -import "monkey/object" +import( + "fmt" + "monkey/object" +) var builtins = map[string]*object.Builtin{ "len": &object.Builtin{ @@ -17,4 +20,12 @@ var builtins = map[string]*object.Builtin{ } }, }, + "puts": &object.Builtin { + Fn: func(args ...object.Object) object.Object { + for _, arg := range args { + fmt.Println(arg.Inspect()) + } + return NULL // puts only print things passed into it, it does not return a value when used in a function or such. + }, + }, }