aboutsummaryrefslogtreecommitdiff
path: root/go/src/step2_eval
diff options
context:
space:
mode:
authorJoel Martin <github@martintribe.org>2014-10-06 21:03:03 -0500
committerJoel Martin <github@martintribe.org>2014-10-06 21:03:03 -0500
commit17e1c5f9f4006399398e8bb7e219a79962ebf3f0 (patch)
treecb7de0111d91c56ae61ee500a2798264773cf54b /go/src/step2_eval
parentaf8fdff41e260b1b21be0e127afb536980f43804 (diff)
downloadmal-17e1c5f9f4006399398e8bb7e219a79962ebf3f0.tar.gz
mal-17e1c5f9f4006399398e8bb7e219a79962ebf3f0.zip
go: add step5_tco. Refactor env.
Move EnvType interface definition to types.go. Remove Env pointers.
Diffstat (limited to 'go/src/step2_eval')
-rw-r--r--go/src/step2_eval/step2_eval.go7
1 files changed, 4 insertions, 3 deletions
diff --git a/go/src/step2_eval/step2_eval.go b/go/src/step2_eval/step2_eval.go
index 31d6f64..3ab35ed 100644
--- a/go/src/step2_eval/step2_eval.go
+++ b/go/src/step2_eval/step2_eval.go
@@ -79,7 +79,7 @@ func EVAL(ast MalType, env map[string]MalType) (MalType, error) {
}
// print
-func PRINT(exp MalType) (MalType, error) {
+func PRINT(exp MalType) (string, error) {
return printer.Pr_str(exp, true), nil
}
@@ -101,11 +101,12 @@ var repl_env = map[string]MalType{
// repl
func rep(str string) (MalType, error) {
var exp MalType
+ var res string
var e error
if exp, e = READ(str); e != nil { return nil, e }
if exp, e = EVAL(exp, repl_env); e != nil { return nil, e }
- if exp, e = PRINT(exp); e != nil { return nil, e }
- return exp, nil
+ if res, e = PRINT(exp); e != nil { return nil, e }
+ return res, nil
}
func main() {