4 ms·
Helluw, one of the core devs here. This was originally an idea just to display whats possible with the Python AST. It's pretty neat. The result is an kinda fanc
by Foxboron 12y ago
Helluw, one of the core devs here. This was originally an idea just to display whats possible with the Python AST. It's pretty neat. The result is an kinda fancy lisp variant with bidirectional interop, macros and all the fancy lisp stuff.
- gknoy 12y agoIs this something that can be integrated easily with existing Python code? I'd be interested in implementing a small module in Hy, rather than Python, and then include/use/consume it from Python. All the uses I saw listed on the blog were as a replacement for Python, it seemed like, so this might be a direction of integration that wasn't intended. edit: Perhaps I should read more and ask less. It looks like this is what `import_file_to_module` does, right? :-)
- Foxboron 12y agoAll you gotta do is import hy before the given hy module. Hy uses a metaimporter to parse the Hy code and hand the Python compiler AST. So you can import any hy file like normal Python and use the code. Its that simple.
- robhardy 12y agoIs there some way to incorporate Hy snippets into an existing Python script? The plan is that this would allow me to incrementally translate my Python scripts into Hy (I'd start with the easy bits, obviously).
- paultag 12y agoHy core here! It works both ways, and bi-directional interop is intended! Just `import hy` then you can import any `.hy` on `sys.path` :D (yes, this means you can make Hy code pip installable, just like Hy itself!)
- gknoy 12y agoWow. That sounds amazing!