I am unable to submit multiple lines of Hy to Python without indentation:
import hy
expr=hy.read_str("(+ 1 1)(+ 2 2)")
hy.eval(expr)
=> 2
The second '(+ 2 2)' statement has apparently been ignored.
Obviously Python's raison d'etre is indentation, and of course the 'Hy Style Guide" shows everything constantly indented, and has this to say as well:
"New lines must ALWAYS be indented past their parent opening bracket."
So is there no way to avoid indentation in Hy and to submit a single, non-indented string via hy.eval(expr)?
Hy is a free-form language, like most programming languages and unlike Python. The style guide is only a style guide.
What you're seeing with read-str
is issue #1591. Use do
to combine multiple expressions into one.