Hacker News new | ask | show | jobs
by filoeleven 2265 days ago
Here’s a trivial extension to one of your examples:

  (if (= a b c) true)
In JS it looks like this:

  if (a == b && b == c) return true;
Let’s build an even bigger one! Clojure:

  (if (or (= a b c)
          (not= d e))
      true)
And in JS:

  if ((a == b && b == c) 
      || d != e) 
    return true;
More verbose, contains some weird symbols, and I’m not sure that my line breaks are helping anybody.

Wanna see if an “array” is full of the same value?

  (apply = [2 2 2])
In JS:

  [2, 2, 2].every( (val, i, arr) => val === arr[0] )
These are not pathological cases.