After a quick rename, hy’s back, and better then ever.
I’ve taken a slightly different approach, and I’m now doing Python AST generation out of Lisp. I got things working so well, stack traces even make sense:
(defn foo []
(raise (Exception "This isn't great")))
(foo)
And, when run:
(hy)[tag@leliel:~][01:28 PM]$ ~/dev/local/hy/bin/hython foo.hy
Traceback (most recent call last):
File "foo.hy", line 5, in <module>
(foo)
File "foo.hy", line 3, in foo
(raise (Exception "This isn't great")))
Exception
In addition, I’ve added a few new syntax bits, and did some speed tests. Check out the gist — it turns out Hy is on-par with Python (whereas Clojure-Py (although much more featureful) is quite a bit slower)
To just show off a few things, here’s a small script to scrape NEW packages off the website
; NEW scraper
(import "lxml.html"
"urllib2")
(def xpath "//tr[contains(@class, 'sourceNEW')]//td[@class='package']")
(def url "http://ftp-master.debian.org/new.html")
(def page (lxml.html.fromstring (.read (urllib2.urlopen url))))
(for [row (page.xpath xpath)]
(print "NEW:" (row.text_content)))
More to come, methinks!
Design by Simon Fletcher. Powered by Tumblr.
© Copyright 2010