Skip to content

Instantly share code, notes, and snippets.

@gregspurrier
gregspurrier / gist:9634498
Created March 19, 2014 02:34
Think that properties are always enumerated in insertion order in JavaScript? Think again.
# The following is in Node, but Firefox has the same behavior
$ node --version
v0.10.26
tinker:~ greg$ node
> var x = {"z": 0, "2": 1, "0": 2, "a": 3, "-3": 4, "b": 5, "-5": 6, "1": 7}
undefined
> Object.keys(x)
[ '0',
'1',
'2',
@gregspurrier
gregspurrier / env_dump.shen
Created February 4, 2015 15:49
A function to generate code that recreates the state of the current envrionment
(define construct-environment
Globals -> [do | (global-load-sequence Globals)])
(define global-load-sequence
[] -> []
[Name | Names] -> [[set Name (construct-value (value Name))]
| (global-load-sequence Names)])
(define atom?
X -> (or (boolean? X)