Vectors are eager. So they'd need to be finite. Varargs/rest args can be
infinite lazy sequences. So it is appropriate that they are just generic "seq"
abstractions instead of something specific (and eager) like a vector.
--
You received this message because you are subscribed to the Google
On Thursday, May 12, 2016 at 4:10:39 AM UTC-4, Michael Gardner wrote:
>
> There's no need to avoid `apply` altogether, IMO. You could do something
> like this:
>
> (let [raw (list :a 1 :b 2 :c 3)]
> (into {:raw raw}
> (filter (comp even? second)
> (apply hash-map
On Thursday, May 12, 2016 at 3:59:10 AM UTC-4, dennis wrote:
>
> A try:
>
> (let [raw (list :a 1 :b 2 :c 3)]
> (->> raw
>(partition 2)
>(filter #(even? (second %)))
>(map vec)
>(into {})
>(merge {:raw raw})))
>
> => {:b 2, :raw (:a 1 :b 2 :c 3)}
>
There's no need to avoid `apply` altogether, IMO. You could do something like
this:
(let [raw (list :a 1 :b 2 :c 3)]
(into {:raw raw}
(filter (comp even? second)
(apply hash-map raw
BTW, `list` is pretty uncommon. Usually you'd just use a vector literal.
And this is
A try:
(let [raw (list :a 1 :b 2 :c 3)]
(->> raw
(partition 2)
(filter #(even? (second %)))
(map vec)
(into {})
(merge {:raw raw})))
=> {:b 2, :raw (:a 1 :b 2 :c 3)}
2016-05-12 15:46 GMT+08:00 hiskennyness :
> This does what I want
This does what I want but feels nooby-ish, as in "in a month I will do this
without APPLY":
(let [raw (list :a 1 :b 2 :c 3)]
> (apply assoc {}
> :raw raw
> (apply concat
>(filter #(even? (second %))
>(apply hash-map raw)
>