Skip to content

Commit

Permalink
(feat/repl): bind global symbol $? to last repl result
Browse files Browse the repository at this point in the history
  • Loading branch information
qjpcpu committed Oct 21, 2022
1 parent 10c68a4 commit 17ec3cd
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
5 changes: 2 additions & 3 deletions generator.go
Original file line number Diff line number Diff line change
Expand Up @@ -642,9 +642,8 @@ func (gen *Generator) Generate(expr Sexp) error {
if IsList(e) {
err := gen.GenerateCall(e)
if err != nil {
return errors.New(
fmt.Sprintf("Error generating %s:\n%v",
expr.SexpString(), err))
return fmt.Errorf("Error generating %s: %v",
expr.SexpString(), err)
}
return nil
} else {
Expand Down
1 change: 1 addition & 0 deletions repl/repl.go
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ func repl(env *glisp.Environment) {
if expr != glisp.SexpNull {
fmt.Println(expr.SexpString())
}
env.BindGlobal(`$?`, expr)
}

for {
Expand Down

0 comments on commit 17ec3cd

Please sign in to comment.