This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2019-07-08
Channels
- # aleph (10)
- # announcements (4)
- # beginners (25)
- # calva (4)
- # cider (56)
- # clj-kondo (10)
- # cljdoc (1)
- # cljs-dev (58)
- # clojure (42)
- # clojure-austin (5)
- # clojure-dev (90)
- # clojure-europe (2)
- # clojure-greece (2)
- # clojure-italy (3)
- # clojure-nl (63)
- # clojure-quebec (1)
- # clojure-seattle (2)
- # clojure-spain (4)
- # clojure-spec (19)
- # clojure-uk (25)
- # clojuredesign-podcast (5)
- # clojurescript (24)
- # cursive (15)
- # datomic (1)
- # events (1)
- # figwheel-main (10)
- # fulcro (62)
- # graphql (7)
- # keechma (11)
- # nrepl (1)
- # off-topic (12)
- # re-frame (8)
- # reitit (2)
- # remote-jobs (3)
- # shadow-cljs (127)
- # specter (1)
- # sql (43)
- # testing (2)
- # tools-deps (30)
- # xtdb (1)
Why's (->> 1 #(+ % 2))
value "#object" something and not 3? What should I use instead?
@kari.pahula (->> 1 #(+ % 2))
evaluates to #(+ % 2 1)
It evaluates to a function that adds 2 to the argument, ignores the result and returns 1:
user=> ((->> 1 #(+ % 2)) 100)
1
Ok so my first attempt of venturing in the clojure wild failed π
Do you need to provide the function? or would
(->> 1 (+ 2))
accomplish what you are trying to do?as->
and ->>
are designed so they can be invoked inside ->
and between those options you should never need an inline anonymous function inside a threading macro
also you can simplify things with a def bound or let bound function of course
but between all of those, extra parens to make a function literal work is the worst IMHO
#cider @finn.volkel
@iagwanderson for a start, it looks like all of toucan's queries are done via honeysql, though I can't tell you precisely how you would use like
in honeysql, I know it is supported
it has a rule stating that like
is infix https://github.com/jkk/honeysql/blob/master/src/honeysql/format.cljc#L108
given how other things work in honeysql the first thing I would try is where [:like :f.a "baz"]
yes, actually what solve the problem was something similar where ["like" :f.a "baz%"]
I wouldn't be surprised if it accepted :like instead of "like" given how the templating works
but I don't have it set up to try and you do