
Hy, a Lisp that compiles to Python - cabalamat
https://github.com/hylang/hy
======
antimora
This terminal cracked me up: [http://try-hy.appspot.com/](http://try-
hy.appspot.com/)

~~~
bcambel
thanks for the share. It's hilarious!

------
Foxboron
I'll repost two recent blogposts about Hy that have been on Hackernews
recently.

[http://fox.devport.no/?p=82](http://fox.devport.no/?p=82)

[http://asylum.madhouse-project.org/blog/2014/01/26/hy-the-
lo...](http://asylum.madhouse-project.org/blog/2014/01/26/hy-the-logical-
choice/)

------
paultag
Language author here :)

if anyone wants to learn more, we have a pretty sweet team over in #hy on
freenode, and have some MLs and stuff sprinkled around.

~~~
zem
i'll ask you the same questions i asked the parenjs author, and which i think
are pretty much faqs if you're developing a language-hosted lisp dialect.
(some of them, like the interop ones, are answered in the hy docs, but it
would be nice to have a quick up-front list for reference).

* lisp-1 or lisp-2?

* scoping rules?

* 1-way or 2-way python interop?

* lisp support for python objects?

* any support for tco or loop/recur?

* reader macros?

* speed penalty relative to native python?

~~~
paultag
* lisp-1 (Python rules)

* Python (sucks)

* 2-way

* Yep! CLOS syntax

* Yep! hy.contrib.loop - to be promoted soon

* Yep, they're OK, relies on dispatch char that's static

* Very little, actually - it compiles to (pretty sane) Python AST / Bytecode - so good pdb works to debug Hy :)

~~~
zem
awesome, looking forward to checking it out :) shame about the scoping, as you
say, but i guess the python interop made it the natural choice.

------
lloeki
Either I have (good or bad?) luck or I've got some zeitgeist hunch or
something, but first I had a convincing WIP of implementing Ruby in RPython
when Topaz went out, and now while I'm working on a Lisp[0] — again in RPython
— comes Hy.

Well at least Hy is markedly different, as my goal is _not_ to compile _to_
Python AST/bytecode, but "merely" be _implemented in_ (R)Python (and C for
LLVM) with no access to the Python runtime.

[0]: [https://github.com/lloeki/wasp](https://github.com/lloeki/wasp)

~~~
Foxboron
You see the wierd signs in the description for hy? Its actually a wierd way of
spelling Hymenoptera! So, that further confirms your zeitgeist hunch.

[http://en.wikipedia.org/wiki/Hymenoptera](http://en.wikipedia.org/wiki/Hymenoptera)

------
bcambel
Great movement from the community to show some love to FP. I really like
Clojure, and will give Hy a try as well. FP really forces you to write better
code and somehow your thinking starts to change slowly. What I realised is
that after I started to write Clojure, I am writing much more functions in
Python as well. If you haven't tried yet, give FP some chance.

~~~
anaphor
This doesn't make Python any more functional, all it does is change the
syntax.

~~~
bcambel
Python is already functional enough, it's the brain behind the keyboard wasn't
that much functional before ( that was me )

~~~
anaphor
Okay, well at least you can add a proper distinction between variable binding
and assignment (let vs. set!) if you have macros, but that doesn't really make
it more functional, just better.

~~~
emidln
Well, you could implement proper distinction. let and setv both compile to
setattr() in the current scope right now.

------
stcredzero
How about "HAI" \-- a Lisp that compiles to Lolcode?

------
Pirate-of-SV
Most of the programming language Y to language Z requires the user to know
more Z than Y. Kind of losing the point there.

Everything's not only about making points, but still...

~~~
Foxboron
Hy was originally a project to show "Hey, see how awesome Python & AST is!".
Lisp being an easy choice to implement. Just awesome it have turned into
something actually use able and fun to code with.

~~~
anaphor
One use for such a thing I can think of is to use it as a reference for
teaching basic parsing techniques. E.g. have a project for an undergrad course
where they learn how traditional recursive descent parsing works, and then
they get to implement an s-expression parser (possibly to a simplified version
of the python AST).

------
razzmataz
Ages ago, there used to be a python-lisp hybrid called e7. I wonder if that
provided any inspiration.

------
jimmcslim
Has there been any work done on Light Table integration?

~~~
Foxboron
I have been trying to pull-off a nREPL for hy. But haven't really come close
yet. Going to try and do some more work on that front in the near future.

------
mikaelj
Why the non-tsandard names of everything? And... CLOS?

~~~
klibertp
What is the standard you're talking about? Common Lisp? Scheme? Clojure? Emacs
Lisp?

Hy looks like it borrows heavily from Clojure, which borrows from Common Lisp
in terms of names, but they are both different languages and so they differ.
About the only objectionable name I found in Hy is `assoc`, which I'd expect
to return the value with given key and not set it.

And CLOS is quite a good object system, actually. I somehow missed how it's
implemented in Hy, but multiple dispatch would be cute in Python.

~~~
mikaelj

        What is the standard you're talking about? Common Lisp? Scheme? Clojure? Emacs Lisp?
    

Common Lisp, of course. That's what you refer to when you say Lisp today.
Otherwise you'd say Scheme, Clojure or Elisp.

    
    
        And CLOS is quite a good object system, actually.
    

Yes, I agree -- my comment was referring to the fact that it is missing from
Hy.

