Thank you very much, Ray Miller and Gary Trakhman!

On 12/12/2017 02:32 PM, Ray Miller wrote:
Very similar to your solution: (filter (set small-list) big-list)

On 12 December 2017 at 13:24, Deyan Yotsov <de...@yotsov.org <mailto:de...@yotsov.org>> wrote:

    Hello,

    I have one list of potentially up to 2 million strings: big-list.

    Then I have another list, small-list, the elements of which are a
    subset of the elements of big-list.

    I want to sort the elements in small-list so that they become
    sorted in the same way in which they are sorted in big-list.

    The most obvious way to do this, for me, is:

    (filter #(some #{%} small-list) big-list)

    (one by one we take the elements from big-list, we check if they
    are in small-list, and if they are, we add them (in big-list
    order) to the result)

    But of course this performs extremely poorly, especially if
    small-list is say 1M elements, and big-list is 2M elements.

    Suggestions?

    Thank you,

    Deyan

-- 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
    <mailto: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
    <mailto:clojure%2bunsubscr...@googlegroups.com>
    For more options, visit this group at
    http://groups.google.com/group/clojure?hl=en
    <http://groups.google.com/group/clojure?hl=en>
    --- You received this message because you are subscribed to the
    Google Groups "Clojure" group.
    To unsubscribe from this group and stop receiving emails from it,
    send an email to clojure+unsubscr...@googlegroups.com
    <mailto:clojure%2bunsubscr...@googlegroups.com>.
    For more options, visit https://groups.google.com/d/optout
    <https://groups.google.com/d/optout>.


--
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
---
You received this message because you are subscribed to the Google Groups "Clojure" group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com <mailto:clojure+unsubscr...@googlegroups.com>.
For more options, visit https://groups.google.com/d/optout.

--
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
--- You received this message because you are subscribed to the Google Groups "Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to