This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
- # admin-announcements (26)
- # beginners (1)
- # boot (157)
- # cider (46)
- # clojure (52)
- # clojure-italy (19)
- # clojure-japan (31)
- # clojure-russia (61)
- # clojure-sg (3)
- # clojurescript (65)
- # clojurex (7)
- # clojutre (8)
- # datascript (15)
- # editors (19)
- # emacs (9)
- # funcool (13)
- # hoplon (74)
- # ldnclj (13)
- # liberator (20)
- # off-topic (70)
- # om (5)
- # onyx (1)
- # re-frame (5)
- # reagent (20)
- # testing (23)
I have a sorted-set with about 200k integers. I take a subseq of those less than X. The resulting subseq can still be quite large. What I get back is a sequence, but I want it back as a sorted-set.
If I use (into (sorted-map) my-sub-seq), doesn't that do an O(n) deep copy of the subsequence into a new sorted-set?
You might want to look at some of the other contrib data structures for this
You can't do (some-fn (tag= :foo) (tag= :bar)) because the function returned by (tag= :foo) always returns a truthy value (i.e. an empty list) even if there's no element "foo"
@cddr: Indeed. The function returned by
(filter ...) and seems to return the seq of children with the given tag name in one case and just the seq containing the current element in case its tag equals the given tagname in the other case. So it's no predicate at all although the docs say so. The
attr= functions do return proper predicates, though. I'd go and file a bug report.
@cddr: No comments, no confirmation, no nothing. And the last JIRA activity for any issue in that project has been end of 2013. That probably means "fork and fix me" in case you want to use it.
@timvisher: I believe, though I don’t have time before standup to go validate my memory, that
(:gen-class) forces AOT compilation while adding
:main true wires that ns up as the entry point for a JAR
@tsdh It might have been done that way to maximize the library's laziness but I'll throw up a patch and see if I can get some discussion going.
@chris_johnson: Thanks for the input. I have it in my head that I can use an ns with nothing but
(:gen-class) in it as the entry point for a jar, but that’s probably untrue. Mental cruft…
the docs certainly seem to indicate that without
:main true the static main function is not generated.
It’s also possible that you can get away with just
(:gen-class) with the addition of some sugar in
project.clj in the case where you’re using Leiningen
and that adding
:main true becomes vital when you start to leave the warm, blanket-like embrace of Tools™
The presence of
:gen-class by itself does not trigger AOT-compilation. AOT-compilation is always initiated by calling
compile, usually through a build tool.
Does anyone here have a tl;dr on the benefits of using Transducers rather than just piping seqs with
@sdegutis No intermediate datastructures between functions and you can use the same stack of functions in normal clojure code, reducers, and core.async
Technically but you need to use the reducer
reduce functions rather then the ones in core
@sdegutis: without transducers, you would have to implement map, filter, and other common functions for each new context (seqs, channels, etc.)
@sdegutis: to answer your original question, if you have just seqs you don’t need transducers, you can use map, filter, and other core functions the old way
transducers shine when you want to use some other underlying data structure and don’t want to rewrite whole core library
@darwin: Oh so basically this is so Cognitect don't have to rewrite them for channels?
Is there a way to export names from an imported namespace without just re-defing them all?
Should I have to do anything special to get concurrent logging printing without interleaving when I'm using timbre as my logger?
I have a coll with maps that have a
:type. How can I get a count per
:type? group-by is useful, but is there a map for vals?
fn could also be
(juxt first (comp f second)). Just depends on how you prefer really.