3 ms·
This really surprised me, until I implemented a lisp. If variable environments are implemented as hash tables, you're just making a pair out of a hash table. I
by sicp-enjoyer 4y ago
This really surprised me, until I implemented a lisp.
If variable environments are implemented as hash tables, you're just making a pair out of a hash table. In other words, it's basically equivalent to:
function cons(x, y) {
return { "first": x, "second": y };
}
function car(x) { return x["first"]; }
function cdr(x) { return x["second"]; }