diff options
| author | Joel Martin <github@martintribe.org> | 2015-03-04 10:29:46 -0600 |
|---|---|---|
| committer | Joel Martin <github@martintribe.org> | 2015-03-04 10:29:46 -0600 |
| commit | 6cee207674783a1707c3e3c4dcec575112ba1c81 (patch) | |
| tree | 87048f918631dc42828c928b1f87a78e9fbf2b52 /go/src/step0_repl | |
| parent | c67c27e6c295200accf3c95c33e9ca5821268e74 (diff) | |
| parent | 9fb199e2cb2cf44cd61c2a226193a70f6013aadc (diff) | |
| download | mal-6cee207674783a1707c3e3c4dcec575112ba1c81.tar.gz mal-6cee207674783a1707c3e3c4dcec575112ba1c81.zip | |
Merge pull request #12 from tebeka/master
Works when ~/.mal-history does not exist
Diffstat (limited to 'go/src/step0_repl')
| -rw-r--r-- | go/src/step0_repl/step0_repl.go | 32 |
1 files changed, 16 insertions, 16 deletions
diff --git a/go/src/step0_repl/step0_repl.go b/go/src/step0_repl/step0_repl.go index 2e4c47c..644a087 100644 --- a/go/src/step0_repl/step0_repl.go +++ b/go/src/step0_repl/step0_repl.go @@ -1,42 +1,42 @@ package main import ( - "fmt" - "strings" + "fmt" + "strings" ) import ( - "readline" + "readline" ) // read func READ(str string) string { - return str + return str } // eval func EVAL(ast string, env string) string { - return ast + return ast } // print func PRINT(exp string) string { - return exp + return exp } // repl func rep(str string) string { - return PRINT(EVAL(READ(str), "")) + return PRINT(EVAL(READ(str), "")) } func main() { - // repl loop - for { - text, err := readline.Readline("user> ") - text = strings.TrimRight(text, "\n"); - if (err != nil) { - return - } - fmt.Println(rep(text)) - } + // repl loop + for { + text, err := readline.Readline("user> ") + text = strings.TrimRight(text, "\n") + if err != nil { + return + } + fmt.Println(rep(text)) + } } |
