This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2018-04-18
Channels
- # architecture (14)
- # beginners (89)
- # cider (336)
- # cljsrn (2)
- # clojure (181)
- # clojure-berlin (1)
- # clojure-dusseldorf (3)
- # clojure-finland (4)
- # clojure-germany (5)
- # clojure-italy (18)
- # clojure-norway (10)
- # clojure-spec (9)
- # clojure-uk (94)
- # clojurescript (84)
- # cursive (3)
- # data-science (4)
- # datomic (82)
- # emacs (2)
- # events (4)
- # figwheel (1)
- # fulcro (6)
- # graphql (2)
- # hoplon (46)
- # instaparse (24)
- # jobs (9)
- # lein-figwheel (2)
- # luminus (18)
- # lumo (3)
- # mount (1)
- # off-topic (14)
- # onyx (17)
- # parinfer (22)
- # planck (1)
- # protorepl (1)
- # re-frame (50)
- # reagent (7)
- # ring-swagger (6)
- # rum (4)
- # shadow-cljs (94)
- # spacemacs (9)
- # specter (7)
- # tools-deps (2)
- # uncomplicate (4)
- # vim (33)
I’ve been reading through the following page from the compojure-api wiki, and I’m confused by a few things. https://github.com/metosin/compojure-api/wiki/Creating-your-own-metadata-handlers
1. What are let/letk bindings, and what is the difference between them? I can’t find an explanation anywhere in the wiki.
2. How is the vector passed into :let/:letk/:middleware/etc. used by compojure-api? I know that it’s probably going to be macro-expanded, but beyond that it’s unclear how the arg is processed.
3. Why in the example is the _
arg re-used in the method body? Isn’t _
a convention for when an arg is unnecessary?
I suspect that once I understand let/letk bindings better, this will all become clearer, but answers to any of the above would be appreciated.
1. letk/fnk/defnk bindings is explained here: https://github.com/plumatic/plumbing/tree/master/src/plumbing/fnk (it talks only about defnk, but letk uses the same syntax)
@U1NDXLDUG in that link, defnk is a way of assigning args to vars in a function by passing them as :var arg
.
But that’s pretty much already how let bindings function…“let left-val equal right-val”. So what’s the difference in the context of a let binding?