PyPy is ruddy fast. So is Hy.
Time of fib(9), using a simple recursive implementation.
-- show running queries (pre 9.2) | |
SELECT procpid, age(clock_timestamp(), query_start), usename, current_query | |
FROM pg_stat_activity | |
WHERE current_query != '<IDLE>' AND current_query NOT ILIKE '%pg_stat_activity%' | |
ORDER BY query_start desc; | |
-- show running queries (9.2) | |
SELECT pid, age(clock_timestamp(), query_start), usename, query | |
FROM pg_stat_activity | |
WHERE query != '<IDLE>' AND query NOT ILIKE '%pg_stat_activity%' |
using System; | |
using System.Diagnostics; | |
// Some helpers for converting GPS readings from the WGS84 geodetic system to a local North-East-Up cartesian axis. | |
// The implementation here is according to the paper: | |
// "Conversion of Geodetic coordinates to the Local Tangent Plane" Version 2.01. | |
// "The basic reference for this paper is J.Farrell & M.Barth 'The Global Positioning System & Inertial Navigation'" | |
// Also helpful is Wikipedia: http://en.wikipedia.org/wiki/Geodetic_datum | |
// Taken from https://gist.github.com/govert/1b373696c9a27ff4c72a |
" Place me into after/plugin/fireplace.vim in your Vim directory. Don't overwrite anything! | |
augroup fireplace_connect | |
autocmd FileType hy command! -buffer -bar -nargs=* | |
\ Connect FireplaceConnect <args> | |
augroup END | |
function! s:set_up_eval() abort | |
command! -buffer -bang -range=0 -nargs=? Eval :exe s:Eval(<bang>0, <line1>, <line2>, <count>, <q-args>) |
""" | |
This script pulls from the Sunlight Labs "openstates" API | |
to get information about legislators at the state level, | |
do a count of their party affiliations, | |
and return that information as | |
1) a JSON object for visualizations | |
2) a table suitable for embed into an HTML page | |
Information about the specific API used can be found here: | |
http://python-sunlight.readthedocs.org/en/latest/services/openstates.html |
;; hy-lang fizzbuzz | |
(import [itertools [count imap]]) | |
(import [pprint [pprint]]) | |
(defn freq [v n] | |
(->> (* [""] (dec n)) (+ [v]))) | |
(defn fizzbuzz [] | |
(->> (imap (fn [f b n] (or (+ f b) n)) |
function! g:Refresh_hy_python_preview() | |
redir => message | |
redir END | |
let pyfile = substitute(bufname("%"), ".hy", "", "") . ".generated.py" | |
let errfile = substitute(bufname("%"), ".hy", "", "") . ".error" | |
exec "silent !~/hy/bin/hy2py % > " . pyfile . " 2> " . errfile . " || cat " . errfile . " > " . pyfile | |
call MyPreviewVSplit(pyfile) | |
set nomodified | |
"exec "silent !rm " . pyfile . " " . errfile | |
redraw! |
⏚ [nicolasd:~/code/parsley] [parsley] $ python test_parsley.py | |
('root', | |
[(1, 0), (346, 0)], | |
('parens', | |
[(3, 0), (3, 36)], | |
('token', [(3, 1), (3, 12)], 'import-from'), | |
('token', | |
[(3, 13), (3, 28)], | |
'tests.resources'), | |
('token', [(3, 29), (3, 35)], 'kwtest')), |
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))) |