aboutsummaryrefslogtreecommitdiff
path: root/go/src/step0_repl
diff options
context:
space:
mode:
authorJoel Martin <github@martintribe.org>2015-03-04 10:29:46 -0600
committerJoel Martin <github@martintribe.org>2015-03-04 10:29:46 -0600
commit6cee207674783a1707c3e3c4dcec575112ba1c81 (patch)
tree87048f918631dc42828c928b1f87a78e9fbf2b52 /go/src/step0_repl
parentc67c27e6c295200accf3c95c33e9ca5821268e74 (diff)
parent9fb199e2cb2cf44cd61c2a226193a70f6013aadc (diff)
downloadmal-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.go32
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))
+ }
}