Hacker News new | ask | show | jobs
by sicp-enjoyer 1332 days 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"]; }