This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2016-04-13
Channels
- # admin-announcements (2)
- # beginners (27)
- # boot (85)
- # cider (24)
- # cljs-dev (20)
- # cljsrn (16)
- # clojure (73)
- # clojure-brasil (2)
- # clojure-czech (152)
- # clojure-dusseldorf (7)
- # clojure-france (3)
- # clojure-japan (1)
- # clojure-norway (1)
- # clojure-poland (7)
- # clojure-russia (140)
- # clojure-uk (7)
- # clojurescript (66)
- # cursive (20)
- # datomic (8)
- # emacs (7)
- # events (1)
- # hoplon (325)
- # jobs (2)
- # jobs-discuss (69)
- # leiningen (3)
- # off-topic (6)
- # om (48)
- # onyx (82)
- # parinfer (1)
- # planck (10)
- # re-frame (53)
- # reagent (8)
- # ring (103)
- # untangled (13)
- # yada (14)
you'd have to be discouraged from using the lift-ns for anything interesting. and in case it was not obvious, (comp read print read) converts some 'normal' maps into 'fixed-lift-ns' ones...
the print part without the read part seems much less troublesome and could be done outside core
does anyone know of an example on how you would use/alter clojure.core.cache asynchronously?
especially, how would you implement memoization-impl from The Joy of Clojure? >> https://github.com/joyofclojure/book-source/blob/b76ef15248dac88c7b1c77c2d461f3aa522a1461/first-edition/src/joy/memoization.clj
does somebody has some knowledge of core.reducers? I noticed that r/map and r/filter have arities to return "transducers" but if I do (into [] (comp (r/map inc) (r/filter odd?)) (range 10)) it returns an error 😕 any ideas on this? thanks 😄
@carocad: I’m not a reducers expert, but it looks like r/map and r/filter are curried rather than returning transducers
https://github.com/clojure/clojure/blob/master/src/clj/clojure/core/reducers.clj#L161
I came up with this fn to group a seq of maps by multiple keys: https://gist.github.com/pesterhazy/2b99f520f48ff2673c86e3b11f4480d2 Any way to improve this?
To override cons on a custom deftype, should i just need to implement a cons method against clojure.lang.IPersistentCollection? I can't seem to change the default behaviour.
is it legit to do something like:
(fn [coll]
(let [meta (atom {})]
(mapcat #(... modify meta, if one thing do something, if another do something else) coll)))
Every once in a blue moon I resort to side effects from a loop or reduction within a fn, though nowadays I (ab)use volatiles when I do since I don’t need the atomicity guarantee
It’s probably good practice if you’re still developing your clojure aesthetics to at least make a game attempt to solve it only with immutable data structures
I actually did, with a reduce, but to break the reduce up into two smaller maps this is the only way I could do it
What’s your dev environment? (I’ve not coded Java so I’m not sure what the ‘Java way’ is.)
But, yes, CIDER is generally the Clojure way: http://cider.readthedocs.org/en/latest/debugging/
@mrwhite: I would recommend Cursive if you are using intellij. It has a nice debugger.
Under 1.8, which clojure namespaces are compiled with direct linking? I was under the impression that it was just clojure.core, but I’m seeing behavior that makes me think others (for example, clojure.stacktrace or clojure.test) may be direct linked.
The decompiled code for (defmethod clojure.test/report :error)
invokes clojure.stacktrace.print_cause_trace/invokeStatic()
directly, following the direct linking pattern. Is this intentional?
This affects how io.aviso/pretty and clojure.test operate (it disables pretty’s ability to provide an alternate implementation of print-cause-trace).
it is all aot compiled in one step in the clojure build, likely with the same settings
That is problematic. I may have to change pretty to do a (load “/clojure/test.clj”)
after it alters the root of print-cause-trace
.
Can’t get spyglass memcache library to work, it returns nil even value 100% in memcached
I try to avoid it because it just seems to make the code appear messier but I think I have a use case for it to encapsulate a predicate that’s only used in one function.
I’ve installed cryogen. I want to customize the template and have a picture at the top of my page. So I put it in base.html, but when I go to another page, for example archives, the image is broken
because picture is src=« img/pic1.png »>. However archives page extends base.html, it should work
Anyone know if it’s possible to join two symbols in a quasi-quote without a space between?
e.g.:
(def a ‘foo-)
(def b ‘bar)
`(~a~b) ;;=> (foo- bar)
but I really want (foo-bar)
@jballanc you could do (symbol (str a b))
(or your version with name
). Without some sort of function called on the two values the symbols are going to be separate forms to the reader (hence the whitespace).
Hmm…I suspected as much. Was hoping their might be some trick of splicing unquote that would make it work.
You could use format,
~(symbol (format "%s-%s") (name a) (name b))
though I'm not sure you're getting much more by doing it.Does anyone know of a way to force loading of files? I have multimethods whose definitions are in multiple files, but nothing directly "require"s them, so the files aren't being loaded, it seems.
Could you just add them to the :requires
in a file that relies on them?