Fork me on GitHub
#clojure
<
2016-10-07
>
borkdude12:10:34

What’s wrong with this expression?

(case 'FOO
  'FOO 1
  'BAR 2)

borkdude12:10:26

the cases have to be unquoted

joost-diepenmaat12:10:05

“cases” are unevaluated constants, so this is equivalent to roughly (if (= ‘FOO ‘(quote FOO) …)

joost-diepenmaat12:10:21

IME often you don’t notice the difference because the test-constants tend to be self-evaluating literals, like numbers, keywords or strings.

elenam12:10:38

Does anyone know how to clone a project from git in Nightcode 2.1? There doesn't seem to be an obvious option/shortcut.

ludothehun13:10:29

Hello, has gRPC been wrapped nicely by anyone yet, I'm staring at one of those inpenetrable java walls here: https://github.com/grpc/grpc-java

greenhorse20:10:38

@elenam Try asking in #editors channel

ag22:10:28

is there a core function that checks for empty? regardless of the type? I could do something like this:

#(cond
                  (number? %) (zero? %)
                  (or (sequential? %) (string? %)) (empty? %)
                  :else (nil? %))
but maybe there’s better way?

sihingkk23:10:19

@ag why you need such function? it’s a bit fishy 😉

ag23:10:23

@sihingkk I have this:

(defn remove-empty-vals [m]
  "Removes all empty values from a map"
  (let [empty' #(cond
                  (number? %) (zero? %)
                  (or (sequential? %) (string? %)) (empty? %)
                  :else (nil? %))]
    (into {} (filter #((comp not empty') (second %)) m))))
doesn’t look very nice