PyPy is ruddy fast. So is Hy.
Time of fib(9), using a simple recursive implementation.
| #!/usr/bin/env hy3 | |
| ;;; doto.hy - do something to a bunch of other things. | |
| ;;; Copyright (c) Paul R. Tagliamonte, MIT/Expat, 2014. | |
| ;;; | |
| (import | |
| os sys subprocess | |
| [concurrent.futures [ThreadPoolExecutor]] | |
| [itertools [groupby]] |
| DEF_NAME print | |
| DEF_CONST omgfst "omgfast" | |
| DEF_LABEL hi | |
| LOAD_GLOBAL print | |
| LOAD_CONST omgfst | |
| CALL_FUNCTION 1 | |
| POP_TOP | |
| JUMP_ABSOLUTE hi |
| ;;; Hy tumblr printer. | |
| ;;; Copyright (c) Paul R. Tagliamonte, 2013, MIT/Expat license. | |
| (import [urllib2 [urlopen]] | |
| [lxml [etree]] | |
| [sys [argv]]) | |
| (defn get-rss-feed-name [tumblr] |
| (defn fib [] | |
| (setf a 0) | |
| (setf b 1) | |
| (while true (yield a) (setf (, a b) (, b (+ a b))))) | |
| (setf it (fib)) | |
| (for [x (range 10)] | |
| (print (next it))) |
| (import-from pymongo Connection) | |
| (def connection (Connection "localhost" 27017) "test") | |
| (def db connection.test) | |
| (def hello db.test) | |
| (for [x (.find hello {"hello" {"$exists" true}})] | |
| (print (get x "hello"))) |
| /* 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 */ |
| #!/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)) |
PyPy is ruddy fast. So is Hy.
Time of fib(9), using a simple recursive implementation.
| ; 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"]) |
| ; 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))) |