Thanks!
Looks like subvec is the best one for the kind of task (i.e. when
preserving element order matters) - if the sequences are finite, non-lazy
collections - e.g. lists or vectors.
среда, 26 сентября 2012 г., 15:16:49 UTC+4 пользователь Niels van Klaveren
написал:
>
> There's several differ
There's several different options, best read up on the differences between
these differences in the docstrings:
(remove (set b) a)
(clojure.set/difference (set b) (set a))
(last (clojure.data/diff a b))
On Wednesday, September 26, 2012 10:46:57 AM UTC+2, Alex Shabanov wrote:
>
> Good day,
>
>
I found the following:
(letfn [(foo [a b] (subvec a (count b)))] (foo [1 2 3 4] [1 2]))
but is it the best one?
Good day,
>
> There is a function FOO that receives two sequences: say, A and B. There
> is an absolute guarantee that sequence B is received from sequence A by
> applying next to it
Good day,
There is a function FOO that receives two sequences: say, A and B. There is
an absolute guarantee that sequence B is received from sequence A by
applying next to it N times, e.g. B == (next (next (next... A) | A.
What is the fastest way to return sequence C from the function FOO that