This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2016-05-25
Channels
- # beginners (27)
- # boot (49)
- # cider (51)
- # cljs-dev (29)
- # cljsjs (1)
- # cljsrn (19)
- # clojure (59)
- # clojure-austin (2)
- # clojure-belgium (19)
- # clojure-china (1)
- # clojure-dev (14)
- # clojure-dusseldorf (7)
- # clojure-russia (8)
- # clojure-spec (115)
- # clojure-uk (45)
- # clojurescript (118)
- # css (6)
- # cursive (8)
- # datascript (20)
- # datomic (32)
- # emacs (5)
- # events (2)
- # flambo (21)
- # hoplon (58)
- # incanter (8)
- # jobs-rus (1)
- # jobs_rus (1)
- # off-topic (3)
- # om (22)
- # om-next (9)
- # onyx (5)
- # other-languages (79)
- # re-frame (126)
- # reagent (6)
- # ring (7)
- # specter (1)
- # untangled (119)
- # yada (38)
@bojan.matic: @bwstearns I think chestnut does what we want
@bojan.matic: closp delivers that: https://github.com/sveri/closp plus a lot of more stuff that you might / might not need
so, a question that I think was already asked here, comes to my mind: is there a way to explore all the available lein templates?
http://www.clojure-toolbox.com/ has not all, but I think the most popular should be there
so there is no way to see all the available templates? how does lein look for them then?
I did not say there is none, thats just what I am looking for. I dont know how leiningen looks for them, hopefully someone else does 🙂
sorry, you might have read that in the wrong tone (damn text-based communication) 🙂
That should give you (I think) all of them
You could also run lein search lein-template
from the command line
is it possible to write a macro that return multiple key value pairs ”in place", rather than returning a map?
As I said in #C03S1KBA2 (repeated here for the benefit of others): Why not just use a function? (pad-fn "25px" {:color "blue"})
— macros don’t compose so functions are nearly always preferable.
Although a lot of people think about "the power of Lisp" being about macros, in reality macros aren’t used as much as you might think, and even those that are used tend to have a function underneath that does the heavy lifting.
Using a function here would allow for composition with similar functions that added style attributes: (def margin-and-padding (comp (partial margin-fn "5px") (partial pad-fn "25px")))
— now you can say (margin-and-padding some-style)
and have both margins and padding added consistently.
@mattsfrey: I've come across this as well, usually working with hiccup. Coming from within HTML or some other templating library, one's mind sort of gets stuck thinking we can resolve sibling nodes in place. Have you tried treating the hiccup as a plain old data structure instead and using tools like into
or reduce
?
I mostly do hiccup as plain data - we just have one particular use case where we have decided to set default styles in components as top/bottom/right/left so they can be overridden individually, and I wanted just a helper function/macro to allow doing the shorthand
Inside the function you could merge the specified styles over the defaults, so (pad-fn "25px" {:color "blue" :padding-top "10px"})
would only fill in padding for bottom, left, and right.
(defn pad-fn [size style] (merge {:padding-top size :padding-right size :padding-left size :padding-bottom size} style))