Just listened to the branching out episode, another highly enjoyable one. As there is a talk of branches, I was wondering if function definitions with different arity branches are considered a conditional, or if they use a conditional under the covers (I assume they must do, I havent looked at the source code yet)
(defn hello
([] (hello "welcome to Clojure."))
([message] (str "Hello, " message))
([message & _]
(printlin "I can only cope with one message, sorry)
(hello message)))
Hm, interesting idea. I took a quick glance and I can't see clearly how it maps to a conditional, but I would assume that it has to at some point.
If I am reading this right, its just nested if
statements 🙂
https://github.com/clojure/clojure/blob/clojure-1.10.1/src/clj/clojure/core.clj#L4523-L4535
it does look like the right place
that's quite a let block
a 46 line let block for a 5 line body
What happens to in Clojure core should sometimes stay in Clojure core :face_with_hand_over_mouth:
Hahaha. Too true.