diff options
| author | Joel Martin <github@martintribe.org> | 2014-12-18 20:33:49 -0600 |
|---|---|---|
| committer | Joel Martin <github@martintribe.org> | 2015-01-09 16:16:50 -0600 |
| commit | b8ee29b22fbaa7a01f2754b4d6dd9af52e02017c (patch) | |
| tree | f4d977ed220e9a3f665cfbf4f68770a81e4c2095 /go/src/step4_if_fn_do | |
| parent | aaba249304b184e12e2445ab22d66df1f39a51a5 (diff) | |
| download | mal-b8ee29b22fbaa7a01f2754b4d6dd9af52e02017c.tar.gz mal-b8ee29b22fbaa7a01f2754b4d6dd9af52e02017c.zip | |
All: add keywords.
Also, fix nth and count to match cloure.
Diffstat (limited to 'go/src/step4_if_fn_do')
| -rw-r--r-- | go/src/step4_if_fn_do/step4_if_fn_do.go | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/go/src/step4_if_fn_do/step4_if_fn_do.go b/go/src/step4_if_fn_do/step4_if_fn_do.go index f63017b..d90a720 100644 --- a/go/src/step4_if_fn_do/step4_if_fn_do.go +++ b/go/src/step4_if_fn_do/step4_if_fn_do.go @@ -24,7 +24,7 @@ func READ(str string) (MalType, error) { func eval_ast(ast MalType, env EnvType) (MalType, error) { //fmt.Printf("eval_ast: %#v\n", ast) if Symbol_Q(ast) { - return env.Get(ast.(Symbol).Val) + return env.Get(ast.(Symbol)) } else if List_Q(ast) { lst := []MalType{} for _, a := range ast.(List).Val { @@ -84,7 +84,7 @@ func EVAL(ast MalType, env EnvType) (MalType, error) { case "def!": res, e := EVAL(a2, env) if e != nil { return nil, e } - return env.Set(a1.(Symbol).Val, res), nil + return env.Set(a1.(Symbol), res), nil case "let*": let_env, e := NewEnv(env, nil, nil) if e != nil { return nil, e } @@ -96,7 +96,7 @@ func EVAL(ast MalType, env EnvType) (MalType, error) { } exp, e := EVAL(arr1[i+1], let_env) if e != nil { return nil, e } - let_env.Set(arr1[i].(Symbol).Val, exp) + let_env.Set(arr1[i].(Symbol), exp) } return EVAL(a2, let_env) case "do": @@ -154,7 +154,7 @@ func rep(str string) (MalType, error) { func main() { // core.go: defined using go for k, v := range core.NS { - repl_env.Set(k, v) + repl_env.Set(Symbol{k}, v) } // core.mal: defined using the language itself |
