On Fri, Jan 6, 2012 at 10:29 AM, Jonathan Cardoso
<jonathancar...@gmail.com> wrote:
> Hi! I have a small stupid question and I hope you guys can help me...
>
> I wanted to sort a vetor, say [25 5 70] but I can't just use any sort
> algorithm because later I will need to get the index of the element in the
> original vector.
>
> When I use:
>
>  (map-indexed vector [25 5 70]) I get ( [0 25] [1 5] [2 70] )
>
> The question is, how can I sort this list into:
> ( [1 5] [0 25] [2 70] )

user=> (sort-by second (map-indexed vector [25 5 70]))
([1 5] [0 25] [2 70])
user=>

-- 
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

Reply via email to