Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

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.


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


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 :)


Oh, and earmuffs become EARMUFFS, which is also nice.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: