This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2018-07-25
Channels
- # beginners (26)
- # boot (1)
- # cider (21)
- # cljdoc (26)
- # cljs-dev (7)
- # clojure (99)
- # clojure-gamedev (6)
- # clojure-italy (5)
- # clojure-nl (4)
- # clojure-russia (1)
- # clojure-spec (5)
- # clojure-uk (59)
- # clojurescript (49)
- # clojutre (6)
- # component (13)
- # core-async (2)
- # cursive (30)
- # data-science (2)
- # datomic (29)
- # emacs (9)
- # fulcro (100)
- # hyperfiddle (1)
- # jobs (2)
- # luminus (4)
- # lumo (23)
- # off-topic (22)
- # other-languages (37)
- # parinfer (1)
- # re-frame (2)
- # reagent (5)
- # reitit (12)
- # ring (12)
- # rum (3)
- # shadow-cljs (168)
- # slack-help (1)
- # spacemacs (7)
- # specter (2)
- # tools-deps (8)
- # vim (11)
- # yada (3)
could someone help me understand the symmetrizer function at: https://www.braveclojure.com/do-things/#Symmetrizer ? one thing that is confusing me is the (loop [remaining-asym-parts asym-body-parts final-body-parts []] ,,,) part. So the parts in the brackets after the loop call are "bindings"? How do you know what order to put those 3 bindings and what are the empty brackets at the end for? i know the loop is breaking the seq down into its head and tail but i'm still confused about the ordering of those bindings and how i would have come up with it.
ok, i think i'm grasping it now. the loop bindings seem to follow: loop [what-i-will-be-creating initial-value-of-that-creation 2nd-thing-i-will-be-binding initial-value-of-2nd-creation] In the synthesizer function we are creating the tail of a sequence using the parameters fed into the function (asym-hobbit-body parts) and then also creating the final body parts list which is initially an empty vector. Not bad chasote! hahaha
Nor is the meaning, for that matter -- it's just whatever you decide to use as the info to keep track of from loop iteration to loop iteration.
that's right. that's a common pattern for bindings- let, for and other forms use it as well
Hey people! Can somebody help me with this piece of code?
I am expecting a new map with deleted a deleted value("c") in the vector associated with :a
but I get an object.
I don't need to use partial I suppose 😛
My bad. Sorry!
Hate it when I figure out the solution just after asking for help.
@lilactown Depends what pattern of selection you're imagining? Every other element? Symbols?
every other element. I just went with (map first (partition 2 coll))
but wondering if there's something built-in
take-nth
(if drop-nth existed and did the intuitive thing that would work too...)
TIL! Always discovering new core
functions!
Hi everyone. Does anyone know what the ~'
in this defn syntax means?
(defn ~'spec ...)
Is it creating an unqualified symbol?
If I see some code like this: (:elm-html m "some-str")
, where m is a map, does it mean that if :elm-html
is not found in m
, "some-str" is returned? I would have googed, but seems like a hard thing to google 😜
@yogidevbear In that case, yes. But in general it can be used to put a quoted form literally in the result. Take a look at what this produces
(let [x '(inc 2)] `(list ~'x ~x 'x x ~'(1 2) '(1 2)))
It seems that the most common use for that pattern is to produce an unqualified symbol.
Cool, thanks @mfikes 👍
I'm working on a macro that has me stumped.
Does anyone know how to get this:
(-> {:val1 1} (fn1 arg2) (fn2 arg2))
If I have this?:
({:val1 1} (fn1 arg2) (fn2 arg2))