This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2019-11-29
Channels
- # adventofcode (11)
- # aws (2)
- # bangalore-clj (8)
- # beginners (92)
- # boot (2)
- # calva (26)
- # cider (1)
- # clj-kondo (4)
- # cljs-dev (4)
- # clojure (54)
- # clojure-berlin (5)
- # clojure-houston (6)
- # clojure-italy (12)
- # clojure-nl (7)
- # clojure-uk (39)
- # clojurescript (12)
- # clojutre (6)
- # cryogen (1)
- # cursive (15)
- # datomic (11)
- # duct (1)
- # events (5)
- # fulcro (14)
- # jackdaw (1)
- # joker (2)
- # malli (15)
- # mental-health (1)
- # off-topic (35)
- # reagent (2)
- # reitit (24)
- # rewrite-clj (3)
- # shadow-cljs (19)
- # vim (11)
Oh, Thanksgiving, ci ho messo 24h a capirla
ma poi perche’ si festeggia in uk?
ahah ok 😄
domanda niubba, c’e’ un modo per chiamare un metodo di un defrecord in modo dinamico?
tipo (.f record)
, dove f e’ passato come parametro?
Se c’e’ un protocol:
(defprotocol IFace (foo [this]))
(defrecord MyFace [] IFace (foo [this] "foo"))
(def my-face (MyFace.))
((ns-resolve *ns* (symbol "foo")) my-face)
;; "foo"
user=> (defprotocol P (f [_]) (g [_]))
P
user=> (deftype T [] P (f [_] 1) (g [_] 2))
user.T
user=> ((rand-nth [#'f #'g]) (T.))
1
user=> ((rand-nth [#'f #'g]) (T.))
2
`grazie a tutti e 2 🙂