This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2016-07-21
Channels
- # admin-announcements (4)
- # beginners (41)
- # boot (46)
- # cider (8)
- # clojure (132)
- # clojure-austin (15)
- # clojure-belgium (3)
- # clojure-greece (3)
- # clojure-hk (1)
- # clojure-mexico (4)
- # clojure-quebec (5)
- # clojure-russia (46)
- # clojure-spec (225)
- # clojure-taiwan (1)
- # clojure-uk (17)
- # clojurescript (46)
- # clojurewerkz (1)
- # core-async (28)
- # cursive (9)
- # datascript (3)
- # datomic (5)
- # defnpodcast (42)
- # devcards (60)
- # emacs (27)
- # hoplon (7)
- # lein-figwheel (5)
- # leiningen (12)
- # mount (8)
- # om (13)
- # play-clj (2)
- # reagent (47)
- # rethinkdb (5)
- # ring-swagger (7)
- # spacemacs (9)
- # specter (12)
- # testing (1)
- # untangled (1)
- # vim (11)
- # yada (31)
@andrepnh I can't elaborate on it right now because I gotta go, but Go has a lot of flaws.
Broken type system with no generics, awful dependency management (which, for a newish language, is inexcusable given that Java's done it right for at least over a decade)...
most criticism I had or heard of golang can be summarized in this post: http://yager.io/programming/go.html
@andrepnh Things might have changed, but last time I checked, Go's built in dependency management essentially only lets you get the master branch of a GitHub repo. No version management, nothing.
I do remember that some people came up with things like third party dependency managers that are meant to solve this issue, but...
My favourite part of Go is that I can write stuff in comments, that changes my code!
You guys might want to move this discussion over to #C03RZGPG3 since it’s no longer really about Clojure.
Hey everyone, I've got a question. How would I pair up two data structures?
Example.. I have..
[["a" "b"], ["1", "2"]]
And I want them to be..
[["a", "1"], ["b", "2"]]
think of it as the firsts and the seconds - does that help?
Sorry, I probably should've elaborated a bit. Pairing up two of them is easy. The collections I have actually contain around 15 values each.
I've paired two of them, using the first and last options. But that won't be possible when there's more than 2.
Assuming all the collections have equal numbers of elements, you can map first
them, then recur this operation to map rest
of these collections, until the first collection is empty.
you could use interleave
then partition
interleave takes the first of each, the second of each, the third of each, ...
then partition by N
also fully lazy :)
@d-side: thanks, I've been trying to figure out a way that doesn't involve a loop though. @alexmiller good stuff
I've been experimenting with interleave
to figure out how to use that to my benefit. I suppose I was missing the partition
function. Thx!
@d-side: yup. I just don't want to be the one to write it if/when there's something that does it for me 😃
@byron-woodfork: taking advantage of the fact that map
can also deal with multiple collections as parameters...
And if you want that to scale to arbitrary size, you could do (apply (partial map vector) colls)
@byron-woodfork: there is also partition-all
which is the same as partition
but it won’t chop off any remaining items that can’t be merged. see: http://gigasquidsoftware.com/blog/2015/01/26/partition-with-game-of-thrones-pugs/
You all are awesome! Thx everyone 😃
@codonnell, I wonder what the scale/perf difference is (if any) between using (partial map vector)
and mapv
.
@akiva: I don't quite follow. Where are you suggesting using mapv
?
wonder if I could get some help here. I'm trying to do something really simple. I need to find matching ranges in an interval tree. I found this library
(require '[org.dthume.data.interval-treeset :as it])
which looks like it may be able to do what I need but the documentation for it is... let's just say not the greatest.
So here is the issue. Given this interval tree:
(def cts (into (it/interval-treeset :as-interval :span)
[{:span [6 9] :id 4} {:span [6 8] :id 3} {:span [3 5] :id 2} {:span [0 2] :id 1}]))
all I want is to be able to get something like:
(it/gimme-thevalues cts 7)
=> {:span [6 9], :id 4} {:span [6 8], :id 3}
but for the life of me I can't figure out how to get that from this scant documentation:
http://dthume.github.io/data.interval-tree/codox/org.dthume.data.interval-treeset.htmlthe closest call I found that worked for just one the first interval was this:
(it/first-overlapping cts [7 7])
=> {:span [6 9], :id 4}
which is not quite what I want as I may have overlapping intervals and need all of them
@cezar: These docs seem better than what you linked: http://dthume.github.io/data.interval-tree/walkthrough/walkthrough.html
I haven't tested it, but maybe use select-overlapping, then selection.overlapping-subset ?
I found another here: https://github.com/mobiusinversion/interval-tree but it looks like abandonware and blows up even with the example on the front page