Skip to content

Instantly share code, notes, and snippets.

@ElliotChong
Forked from megamaddu/fighting-insanity.md
Last active August 29, 2015 14:17
Show Gist options
  • Save ElliotChong/8b03e90e8b714894c14c to your computer and use it in GitHub Desktop.
Save ElliotChong/8b03e90e8b714894c14c 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.a;
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

..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