Re:Hy – A dialect of Lisp that’s embedded in Python
by austinz on Wednesday December 03, 2014 @07:25PM
(#8697211)
Python natively supports this sort of list comprehension (https://docs.python.org/2/tutorial/datastructures.html#list-...), and the Lisp source is being translated into a Python AST, so that snippet is probably being directly mapped into whatever AST form is necessary to invoke the list comprehension.
[ Parent
| on HN ]
Re:Hy – A dialect of Lisp that’s embedded in Python
by paroneayea on Wednesday December 03, 2014 @07:39PM
(#8697250)
Yes that's exactly what's happening. Hy has two levels of things mostly: a "compiler" that does the low-level mapping of base python constructs (and whatever can be mapped to AST)... here's where list-comp is implemented: https://github.com/hylang/hy/blob/master/hy/compiler.py#L137...
Anything above that is written as Hy macros, in Hy itself: https://github.com/hylang/hy/blob/master/hy/core/macros.hy
There's a lot of other core code that's written in Hy itself too. https://github.com/hylang/hy/tree/master/hy/core
Re:Hy – A dialect of Lisp that’s embedded in Python
by Foxboron on Wednesday December 03, 2014 @07:33PM
(#8697237)
Yes thats correct.
https://github.com/hylang/hy/blob/dcf29d3d2a147fe66a19971214...
Source for those interested. Note that Hy replaces all - in names for _, thus we can have prettier names :)