This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2018-10-16
Channels
- # 100-days-of-code (1)
- # announcements (1)
- # beginners (93)
- # boot (46)
- # cider (40)
- # cljdoc (4)
- # cljs-dev (7)
- # clojure (78)
- # clojure-conj (12)
- # clojure-dev (17)
- # clojure-italy (5)
- # clojure-nl (10)
- # clojure-spec (34)
- # clojure-uk (36)
- # clojurescript (56)
- # code-reviews (6)
- # core-async (31)
- # cursive (12)
- # datascript (9)
- # datomic (19)
- # devops (2)
- # editors (3)
- # emacs (6)
- # events (2)
- # figwheel (1)
- # figwheel-main (11)
- # fulcro (59)
- # graphql (10)
- # hyperfiddle (3)
- # keechma (5)
- # leiningen (26)
- # luminus (1)
- # nrepl (5)
- # re-frame (5)
- # reitit (10)
- # shadow-cljs (64)
- # spacemacs (29)
- # tools-deps (6)
- # uncomplicate (8)
- # vim (2)
- # yada (4)
letfn
is an IOC boundary as a whole, but it seems only bound functions should be, not the body.
e.g (a/go (letfn [(f [x] (do-something-with x))] (f (a/<! port))))
looks perfectly legit to me, but fails because <!
is outside of go
boundaries. Is this intended, and why ?
letfn is a special from with special semantics (namely that you can use any of the fns that you define in its bindings in any order), which I think is the issue. it holds onto the body of the letfn until the very last minute, so the go block can't properly see the <! to transform it away.
I can't really explain it very well, but if you do something like (clojure.walk/macroexpand-all '(go (letfn [(f [x] (println x))] (f (<! port)))))
vs (clojure.walk/macroexpand-all '(go (let [f (fn [x] (println x))] (f (<! port)))))
then you can see that the (f (<! port))
still exists in the paren soup that gets spit out in the first case, but it works how you're expecting in the second case
so basically, the explanation is that letfn
is weird
also, that might just be a bug?
ha yeah, I typed all of that up and then thought about it one more time and realized it's probably just a bug
can't wait to hear about your strategy on this one @bronsa that sounds definitely fixable but all the solutions I can think of fight against the overall design
that looks pretty simple. can someone add a test?
it works because clojure.core has a function named odd?, but if you rename it then it won't compile
I see what's happening
it's collapsing the letfn into a regular let
it's binding the name of the fn after the fn has been defined, but that means that odd? doesn't exist when even? is defined
which happens to work when you use odd? and even? but if you change the names of the functions, it breaks
Hi! I'm having problem with integrant and channels in the repl. When I start the application all my channels works fine. Then when I stop and start again, it is like the new channels are closed. When I send a message on the channel it replies with false. On the halt-hook I'm closing the existing channels and when starting again I'm creating new ones. Should I try to keep them when restaring or is there anything else I'm doing wrong?
aaa sorry I'm new here. I will check in the integrant channel