Julien Danjou: Hy, Lisp in Python
I've meant to look at Hy since
Paul Tagliamonte started to talk to me about
it, but never took a chance until now.
Yesterday, Paul indicated it was a good time for me to start looking at it,
so I spent a few hours playing.
But what's Hy?
Python is very nice: it has a great community and a wide range of useful
libraries. But let's face it, it misses a great language.
Hy is an implementation of a
Lisp on top of
Python.
Technically, Hy is built directly with a custom made parser (for now) which
then translates expressions using the
Python AST module to generate
code, which is then run by Python. Therefore, it shares the same properties
as Python, and is a Lisp-1 (i.e. with a single namespace for symbols and
functions).
If you're interested to listen Paul talking about Hy during last PyCon US, I
recommend watching his lightning talk. As the name implies, it's only a few
minutes long.
<iframe allowfullscreen="allowfullscreen" class="shadow" frameborder="0" height="374" src="http://www.youtube.com/embed/1vui-LupKJI?wmode=transparent&autohide=1&egm=0&hd=1&iv_load_policy=3&modestbranding=1&rel=0&showinfo=0&showsearch=0#t=16m14s" width="500"></iframe>
Does it work?
I've been cloning the code and played around a bit with Hy. And to my
greatest surprise and pleasure, it works quite well. You can imagine writing
Python from there easily. Part of the syntax smells like
Clojure's, which looks like a good thing since they're
playing in the same area.
You can try a Hy REPL in your Web browser if you
want.
Here's what some code look like:
(import requests)
(setv req (requests.get "http://hy.pault.ag"))
(if (= req.status_code 200)
(for (kv (.iteritems req.headers))
(print kv))
(throw (Exception "Wrong status code")))
This code would ouput:
('date', 'Wed, 03 Apr 2013 12:09:23 GMT')
('connection', 'keep-alive')
('content-encoding', 'gzip')
('transfer-encoding', 'chunked')
('content-type', 'text/html; charset=utf-8')
('server', 'nginx/1.2.6')
As you can see, it's really simple to write Lispy code that really uses
Python idioms.
There's obviously still a lots of missing features in Hy. The language if
far from complete and many parts are moving, but it's really promising, and
Paul's doing a great job implementing every idea.
I actually started to hack a bit on Hy, and will try to continue to do so,
since I'm really eager to learn a bit more about both Lisp and Python
internals in the process. I've already send a few patches on small bugs I've
encountered, and proposed a few ideas. It's really exciting to be able to
influence early a language design that I'll love to use! Being a recent fan
of Common Lisp, I tend to grab the good stuff from it to add them into Hy.
Daniel Pocock posted
You might have already
Let's work through each of the steps in the diagram:
The upstream release
After having used mutt for about a decade, I decided it's time I move
away from it, for various reasons that I won't go into here.
I've been evaluating thunderbird^Wicedove now for a few weeks, but I
can already see I won't keep using it forever, because I find too many
issues with it:
I have just uploaded
A few months late, perhaps, but I wanted to mention that my team (Codex) competed, once again, in the
Well, we're back in Brisbane, for good. Now starts the long and involved
process of bootstrapping a new life for myself. Fortunately it's slightly
more familiar territory than starting up in the US was.
The tenants in my Hawthorne apartment have agreed to terminate their lease
early, and I should get the keys tomorrow. The lease on my Woolloongabba
apartment ends on Friday I think, and all of our stuff is scheduled to be
delivered there next Monday.
My primary goal is to get my apartment habitable for Zoe and I as soon as
possible. That means beds and a fridge, and Zoe's going to need some way of
being kept entertained while I'm running around like a chook with its head
cut off, which is most likely going to mean a TV and a DVD player.
This week is going to be spent doing a lot of running around. I need to get
a car, get a Queensland driver's licence, get the electricity on, get the
ADSL on, buy appliances, furnish Zoe's room, furnish my room, heck, furnish
the whole apartment, really. It's going to be very full on busy. I don't
want to race out and buy anything today, even though the shops seem to be
open, because I want to measure up my apartment first.
The day's sole purchase was an electric screwdriver from Bunnings. There
will be much Ikea assembly in my future.
For one of my classes, the final project is to work on a personal project for four weeks. Since I have never done mobile programming before, I decided I would use this project as a chance to teach myself the basics of Android development. Paul Tagliamonte recently
If you have any feature suggestions, questions, or comments, feel free to send me an email (nhandler@debian.org). The source code for the Android application is currently not available, but I plan to put it up in a git repository sometime in the near future. The source code for the Python script that provides a REST API to access the PTS and BTS SOAP interface is available on
Step one: building OpenRC, and force it with a big hammer to replace sysv-rc.


So you probably heard that I have that little new project of mine: 
This weekend I have mostly been reading
The annoucement below just went to the