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 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, >> >> 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 >> contains all the heading entries in sequence A in the same order, that are >> not included in B? >> >> Example: A == [1 2 3 4], B == [3 4], (FOO A B) -> [1 2] >> >> I feel it is impossible to introduce a fast O(N) solution when A and B >> just sequences, and if it is so, what *standard* clojure data structures >> that preserves the order of elements can be used for doing so? >> >> BR, >> Alex >> > -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en