Closed hitmoon closed 10 years ago
Hey, can you explain this? I don't think I understand the change.
The do function i think, is to eval each sentence in sequence and return the result of last one. This behavior is like what is means in Scheme.
That sounds correct. I don't think the ghost
is required because the arguments to do
actually come in evaluated. So the function doesn't do any evaluation itself. It just needs to return the last argument passed.
You can use the "max" or "min" function to test function “do”,your version give wrong output.
Sorry I'm still not sure I understand. Can you post a specific example? Here is do
for me.
lispy> do (min 1 2 4 3) (max 10 23 33 7)
33
lispy> do (+ 10 20) (* 10 20)
200
lispy> do (print "Hello") (1)
"Hello"
1
sorry, from example you give , your “do” function is correct. Maybe there is a subtle difference between our code. Check my code here: github.com/hitmoon/Qlisp
Okay. In that case I'll close this issue. But thanks for the report and I'm glad you enjoyed the book!
First, you done a great job! I think the 'do' function should be like this: ; Perform Several things in sequence (fun {do & l} { if (== l {}) {{}} {(last (map ghost l))} })