PyPy is ruddy fast. So is Hy.
Time of fib(9), using a simple recursive implementation.
| mkdir ~/os | |
| git log openstatesmap.png | grep commit | awk '{print $2}' | tac > ~/allfifty.rev | |
| I=0; while read foo; do git reset $foo --hard; cp openstatesmap.png ~/os/$I.png; let I=$I+1; done < ~/allfifty.rev | |
| convert -dispose previous -delay 20 -loop 0 `ls *.png | sort -n` openstates.gif |
| (ns sunup | |
| (:require sunlight)) | |
| (defn frequencies [coll] | |
| (reduce (fn [counts x] (assoc counts x (inc (get counts x 0)))) {} coll)) | |
| (frequencies | |
| (for [l (kwapply | |
| (.-legislators sunlight/openstates) |
| #!/usr/bin/bpython -i | |
| from sunlight import * | |
| import json | |
| import sys | |
| if '--local' in sys.argv: | |
| import sunlight.services.openstates | |
| sunlight.services.openstates.service_url = 'http://localhost:8000/api/v1' |
| ; Copyright (c) Paul R. Tagliamonte <paultag@debian.org>, 2012, under the | |
| ; terms of dput-ng it's self. | |
| (ns clojtest | |
| (:require dput.core | |
| dput.exceptions)) | |
| (defn log [x] ; for debug output | |
| (.debug dput.core/logger x)) |
| from sunlight import openstates | |
| bills = filter( | |
| lambda x: x != [], | |
| [ | |
| [ | |
| y['url'] for y in x['documents'] | |
| ] for x in openstates.bills(q="rifle", fields='documents', state='ct') | |
| ] | |
| ) |
| ; vim: tabstop=2 expandtab shiftwidth=2 softtabstop=2 filetype=lisp | |
| ; Copyright (c) Paul Tagliamonte, in sofar as any of this is at all | |
| ; copyrightable. | |
| (def hello "World!") | |
| (def square (fn [arg] | |
| (* arg arg))) |
| ; vim: tabstop=2 expandtab shiftwidth=2 softtabstop=2 filetype=lisp | |
| ; Copyright (c) Paul Tagliamonte, in sofar as any of this is at all | |
| ; copyrightable. | |
| (puts "Hello, World!") | |
| ; "Hello, World!" | |
| (import ["os" | |
| "sys"]) |
PyPy is ruddy fast. So is Hy.
Time of fib(9), using a simple recursive implementation.
| #!/usr/bin/env hython | |
| ; not actually clojure ... | |
| (import "urllib2") | |
| (import-from "lxml" "html") | |
| (defn form-pts-url [developer] | |
| "Return the PTS URL for a given developer." | |
| (+ "http://qa.debian.org/developer.php?login=" developer)) |
| /* See: | |
| http://bit.ly/WhXvb3 | |
| for the Traceur */ | |
| var foo = [9, 9, 9], | |
| bar = [2, 2, 2], | |
| baz = [1, 1, ...foo, 1, 1, ...bar, 1, 1]; | |
| console.log(baz); | |
| /* Output: 1,1,9,9,9,1,1,2,2,2,1,1 */ |