You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on May 27, 2022. It is now read-only.
If you use print as the last expression in an s-expression:
(let [[a 1]]
(print a))
You get the following error:
File "<ipython-input-12-d8822250c158>", line 3
return print(a)
^
SyntaxError: invalid syntax
Looking at the generated python, I can see why it is an error but because it works in the Hy REPL so I imagine it has something to do with the way Hy has been interfaced to the expectations of the notebook. Because the notebook only prints the return value of the last expression executed, using print statements for everything you want to see is a common pattern.
Thanks!
There is a bit of a kludge for now...
(let [[a 1] [b 2]
(print a)
None)
The text was updated successfully, but these errors were encountered:
If you use print as the last expression in an s-expression:
(let [[a 1]](print a))
You get the following error:
File "", line 3
return print(a)
^
SyntaxError: invalid syntax
Looking at the generated python, I can see why it is an error but
because it works in the Hy REPL so I imagine it has something to do with
the way Hy has been interfaced to the expectations of the notebook. Because
the notebook only prints the return value of the last expression executed,
using print statements for everything you want to see is a common pattern.
Thanks!
There is a bit of a kludge for now...
(let [[a 1] [b 2](print a)
None)
—
Reply to this email directly or view it on GitHub #16.
How the hy repl makes the magic happen without the future is more of the dark AST arts that I am trying to avoid digging into. Until I figure out a way to solve some of those issues, crazy things like print and input will continue to be obnoxious. Hope the workaround helps!
If you use print as the last expression in an s-expression:
You get the following error:
Looking at the generated python, I can see why it is an error but because it works in the Hy REPL so I imagine it has something to do with the way Hy has been interfaced to the expectations of the notebook. Because the notebook only prints the return value of the last expression executed, using print statements for everything you want to see is a common pattern.
Thanks!
There is a bit of a kludge for now...
The text was updated successfully, but these errors were encountered: