rework eval loop to unwrap lists when function calls return
This commit is contained in:
parent
1889942db8
commit
3b0fb09e30
3 changed files with 45 additions and 11 deletions
10
cmd/repl.go
10
cmd/repl.go
|
|
@ -106,7 +106,13 @@ func main() {
|
|||
ast.PrintSExprsIndividually(userInput)
|
||||
}
|
||||
|
||||
result := userInput.Eval(funcs, vars)
|
||||
fmt.Println(result.String() + "\n")
|
||||
result, unwrap := userInput.Eval(funcs, vars)
|
||||
if unwrap {
|
||||
result = result.Inner.(*ast.Token)
|
||||
}
|
||||
for i := result; i != nil; i = i.Next {
|
||||
fmt.Printf(i.String() + " ")
|
||||
}
|
||||
fmt.Printf("\n")
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue