Skip to content

Instantly share code, notes, and snippets.

@megamaddu
Last active August 29, 2015 14:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save megamaddu/6a115df115c95d099121 to your computer and use it in GitHub Desktop.
Save megamaddu/6a115df115c95d099121 to your computer and use it in GitHub Desktop.

================

If your language works like this by default..

var x = {a: 5};
var y = {a: 5};
x === y; // => false

..you're fighting insanity..

var x = {a: 5};
var y = x;
y.b = 4;
x === y; // => true
x.b;     // => 4

..and don't let an unfamiliar syntax trick you..

(let [x {:a 5}
      y {:a 5}]
  (= x y)) ;; => true

..because simplicity isn't about syntax..

(let [x {:a 5}
      y (assoc x :b 4)]
  (= x y) ;; => false
  (:b x)) ;; => nil

..it's about minimizing the gap between your brain and the problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment