This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2015-12-14
Channels
- # admin-announcements (283)
- # announcements (1)
- # aws (3)
- # beginners (24)
- # cider (32)
- # clara (13)
- # cljs-dev (1)
- # cljsjs (10)
- # cljsrn (24)
- # clojure (179)
- # clojure-dev (6)
- # clojure-russia (149)
- # clojurecup (5)
- # clojurescript (33)
- # cursive (23)
- # datomic (35)
- # devops (6)
- # emacs (1)
- # jobs-rus (11)
- # ldnclj (77)
- # lein-figwheel (1)
- # luminus (3)
- # off-topic (3)
- # om (179)
- # onyx (13)
- # proton (6)
- # reagent (60)
- # testing (1)
@si14 all good.
hiccup certainly has the problem of not being "designer friendly", but it is a very powerful templating system, because you have the full power of a programming language at your disposal.
So "template inheritance" should be a piece of cake
I know, but I have a site with more then 10 pages and all pages needs the same header and footer
Doesn't that just mean the header and footer are components?
reusable
Or ...
(defn page
[main]
[:div
[header]
[main]
[footer]])
pass the main
bit into the page
Anyway, I guess I'm just saying that hiccup is the equal of any templating system.
I see the idea . I can put it all the code of the header and the footer. so only main has to be filled in
Yep, you have a complete programming language at your disposal. I don't quite know why you would do the following, but it shows that hiccup is just a returned data structure :
(defn page
[main]
(into [:div] (map vector [header main footer])))
Hey! I get a lot of these: Warning: reagent19.getDOMNode(...) is deprecated. Please use ReactDOM.findDOMNode(instance) instead
Cannot find any issues on Reagent’s Github. And I’m running newest versions of Reagent. None of my code is calling getDOMNode
directly
Hi, I find myself often that for the need of keys in "for" loops I want to reach for the counter of the seq. This leads to code that does not (for [x xs]... but (for [n (range 0 (count xs)]...(nth xs n)... Is there a more idiomatic solution for this problem?
yeah just noticed https://clojuredocs.org/clojure.core/map-indexed
If you need a for comprehension (wouldn't call it a loop) with index then I'd zip the sequence with the range.
I quite like this implementation:
(defn zip
"Zips collections."
[& colls]
(partition (count colls) (apply interleave colls)))
@jaen: Hm, I dont understand how that zip helps? It returns this for me: (zip ['a 'b 'c]) => ((a) (b) (c))
You can't do (for [idx (range) elem your-coll] ...)
since that will result in a cartesian product, right?
It's probably less popular in Clojure than in Haskell, since Clojure has varargs, but it can be useful nonetheless.
@jaen: u can also zip with smth like (map vector (iterate inc 0) some-seq)
Yeah, I know about the map-the-vector trick, but I prefer to have a function defined, it's less cryptic that way.
It would be interesting though to see how mapping vector
compares performance wise to that implementation.
You can just do (map (fn [x i] ...) xs (range))
and it’ll terminate when reaching the end of xs
I don’t find map-indexed
very idiomatic, it doesn’t seem to compose as well as just mapping over several sequences
@mbertheau: in re-com
Hey, I'm having issues with the following code: https://gist.github.com/philjackson/a79a7a6756cb0ad5387b
When buffer
is updated, the first time codemirror appears, from then on though, :component-did-mount
doesn't fire.
hi. is it possible to have a colspan attribute ala [:td {:colspan 6} "stuff here"] in reagent?
thanks @gadfly361