This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2020-11-29
Channels
- # announcements (1)
- # babashka (1)
- # beginners (46)
- # calva (2)
- # cider (6)
- # circleci (10)
- # clj-kondo (2)
- # cljsrn (2)
- # clojure (30)
- # clojure-dev (6)
- # clojuredesign-podcast (8)
- # clojurescript (28)
- # conjure (1)
- # core-logic (2)
- # core-matrix (2)
- # cryogen (16)
- # figwheel-main (2)
- # graalvm (4)
- # jobs (1)
- # malli (15)
- # minimallist (1)
- # off-topic (70)
- # pathom (4)
- # reagent (3)
- # releases (2)
- # remote-jobs (8)
- # rewrite-clj (3)
- # shadow-cljs (4)
- # tools-deps (29)
- # uncomplicate (3)
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
What happens to in Clojure core should sometimes stay in Clojure core :face_with_hand_over_mouth: