This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2015-11-06
Channels
- # admin-announcements (59)
- # announcements (1)
- # beginners (67)
- # boot (140)
- # cljsrn (8)
- # clojure (70)
- # clojure-berlin (18)
- # clojure-dev (7)
- # clojure-russia (53)
- # clojurescript (124)
- # clojurescript-ios (3)
- # clojurewerkz (2)
- # clojurex (10)
- # code-reviews (42)
- # cursive (9)
- # datomic (2)
- # editors-rus (2)
- # emacs (5)
- # events (1)
- # hoplon (35)
- # jobs (8)
- # ldnclj (7)
- # lein-figwheel (34)
- # luminus (1)
- # om (410)
- # onyx (22)
- # overtone (19)
- # portland-or (6)
- # re-frame (1)
- # yada (4)
e.g. if it was in a {} and you called it, it could expand to both the key and the value?
Actually, a function might be fine, as I can evaluate all the arguments. But I still need to expand it out somehow.. Hmm.
@moxaj: For sure, not the best example on why. I'm actually trying to expand out 2 arguments of a library, which can be in any number of places, AND need to be mixed with a lot of others.
Basically, I'd want a macro that looked something like this:
(defmacro x
[]
:key :value)
and an example usage:
{:foo :bar
(x)}
and would compile to:
{:foo :bar
:key :value}
@moxaj: But I'd also want it to work elsewhere, e.g.
(myfn (x))
=> (myfn :key :value)
@dm3 So, there's a function consuming keys & values as [& {:keys [x y z]}], and I want to expand in a few to cut down on repetition, mostly because the key/value are mixed (as in, the key contains part of the value)
I suppose that would allow me to compose them.. yes. I wish this library allowed the call as a hashmap, then I'd just have to merge the two!
I didn't write the original macro, it's actually enlive! I thought I'd have better success than this.
in macros &form
is available
it gives you the enclosing form, eg {}... so you could do this
i've never seen it done, maybe it's bad, but it might be awesome
https://github.com/cgrand/enlive/issues/136 I've opened an issue, hoping someone has something specific to my scenario.
actually i guess it's not possible because of the even-numbered entries the reader requires
defsnippet is actually a very thin macro: https://github.com/cgrand/enlive/blob/be075b124eb8c4e00b271e21ad63b3a8de6ecb87/src/net/cgrand/enlive_html.clj#L618
But, in general, this is why macros are bad, and you should always provide a form which takes a plain ol' map.
Hello there, any reason to still use use
? In brave clojure book, daniel use it but I saw an blog article on 8thlight that use
is now useless since Clojure 1.4 ?
I may miss a sentence like « just to illustrate, don’t use it », but in my ebook version he speaks about it
"require and use ensure that a namespace exists and is ready to be used, and optionally let you refer and alias the corresponding namespaces. You should use ns to call require and use in your source files. https://gist.github.com/ghoseb/287710/ is a great reference for all the vagaries of using ns."
Ah, it looks like he's opted to cover everything. But the recommended way to import everything from a namespace is now :refer :all
the only time I use use
is at the repl when I'm hacking b/c it's shorter
hello everybody
i got a coworker trying to get clojure up and running and he seems to be bumping into the issue captured in this gist
lein repl command hitting a ' java.lang.IllegalArgumentException: array element type mismatch' exception
anybody see this before?
@johangrufman: I'm guessing,, it's some bad syntax somewherre
Go back to a known stable state - get the repl working, then load the new code into the repl
that will highlight it
In a new folder, does "lein new app spork; cd spork; lein repl" also cause a java.lang.IllegalArgumentException?