I believe what he wants is a persistentlist. You could get one from (apply
list) or more succinctly/esoterically (list* ..)
Sort returns a seq view over the array returned by java.util.Array.sort()
(defn sort
"Returns a sorted sequence of the items in coll. If no comparator is
supplied, uses compare. comparator must
implement java.util.Comparator."
{:added "1.0"
:static true}
([coll]
(sort compare coll))
([^java.util.Comparator comp coll]
(if (seq coll)
(let [a (to-array coll)]
(. java.util.Arrays (sort a comp))
(seq a))
())))
(class (sort (range 10)))
clojure.lang.ArraySeq
On Fri, May 2, 2014 at 11:01 AM, Plínio Balduino <[email protected]>wrote:
> Hi Dave
>
> Sorry if I didn't get it, but doesn't sort already return a list?
>
> Could explain?
>
> Plínio
>
>
>
> On Fri, May 2, 2014 at 11:53 AM, Dave Tenny <[email protected]> wrote:
>
>> I have a sequence from a call to 'sort'.
>> I want a list.
>>
>> What is the best way to do this?
>>
>> (apply list (sort ...))?
>>
>> Will it have problems on large sequence inputs?
>>
>>
>> I can't use (into () (sort ...))
>> since that conjoins and ruins the sort order.
>>
>>
>> --
>> You received this message because you are subscribed to the Google
>> Groups "Clojure" group.
>> To post to this group, send email to [email protected]
>> Note that posts from new members are moderated - please be patient with
>> your first post.
>> To unsubscribe from this group, send email to
>> [email protected]
>> 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 [email protected].
>> 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 [email protected]
> Note that posts from new members are moderated - please be patient with
> your first post.
> To unsubscribe from this group, send email to
> [email protected]
> 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 [email protected].
> 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 [email protected]
Note that posts from new members are moderated - please be patient with your
first post.
To unsubscribe from this group, send email to
[email protected]
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 [email protected].
For more options, visit https://groups.google.com/d/optout.