This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
@hlship: main code is actually using a (->> (map (fn ...))) setup so I just tacked doall to the end of it thanks!
What’s a good idiom for splitting or unzipping a list?
[[1 :a] [2 :b] [3 :c]] to [[1 2 3] [:a :b :c]]
[[1 :a] [2 :b] [3 :c]]
[[1 2 3] [:a :b :c]]
also maybe called transposing an array
that’s not built in anywhere is it?
did the prior input come from a map?
nope
actually, I’m wrong in what I want—I want the thing that does let binding parsing
let
[1 :a 2 :b 3 :c] to [1 2 3] and [:a :b :c] in one pass
[1 :a 2 :b 3 :c]
[1 2 3]
[:a :b :c]
I suppose I can just do the cons and reverse thing
there's take-nth as in [(take-nth 2 xs) (take-nth 2 (rest xs))]
take-nth
[(take-nth 2 xs) (take-nth 2 (rest xs))]
will that work in one pass?
each call to take-nth in one pass
it's lazy
so two passes total
gotcha
it’s probably nbd, I’ll go with that one
a clever non-lazy way is (let [{numbers true kws false} (group-by number? xs)] ...)
(let [{numbers true kws false} (group-by number? xs)] ...)
leveraging map-destructuring and an aggregation
of course I could be missing something blindingly obvious. If the sources were a map, (keys map) and (vals map) have an order like (seq map)
I just went with take-nth
it’s unlikely these lists will be long
just feels weird to do a two-pass
also, core.match is beautiful for writing macros
Do undeclared Var warnings get skipped in macro output?
is there a way to get them back if so?
… it’s pretty sad to lose that
@norman: welcome!
hey