Re:A week with Hy
by fouric on Thursday August 08, 2019 @05:32PM
(#20649021)
Does Hy add its own "symbol" datatype, or use something in the standard library?
[ Parent
| on HN ]
Re:A week with Hy
by greenshackle2 on Thursday August 08, 2019 @06:10PM
(#20649370)
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