3 ms·
Own symbol type => 'foo HySymbol(u'foo') Assignment and conditionals are expressions, however assignment returns None. => (setv bar (setv foo (if
by greenshackle2 7y ago
Own symbol type
=> 'foo
HySymbol(u'foo')
Assignment and conditionals are expressions, however assignment returns None.
=> (setv bar (setv foo (if True True False)))
=> (type bar)
<type 'NoneType'>
Quoted expressions evaluate to Hy AST.
=> '(+ 1 2 3)
HyExpression([
HySymbol(u'+'),
HyInteger(1L),
HyInteger(2L),
HyInteger(3L)]
)
So it's kind of a frontend for the Python compiler, it goes:
Hy AST -> Python AST -> Python bytecode
- kazinator 7y agoUsers of Hy who don't know Lisp deserve to be informed that in an actual Lisp, it goes more like this: => 'foo foo (or, at worst FOO rather than foo). => '(+ 1 2 3) (1 2 3)