Re: Sort a vector and keep the elements' indexes

2012-01-06 Thread Jonathan Cardoso
Thanks a lot, guys!! I know there was a simple way!! -- 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 pos

Re: Sort a vector and keep the elements' indexes

2012-01-06 Thread Ambrose Bonnaire-Sergeant
user=> (sort-by second [[0 25] [1 5] [2 70]]) ([1 5] [0 25] [2 70]) On Fri, Jan 6, 2012 at 11:29 PM, Jonathan Cardoso 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

Re: Sort a vector and keep the elements' indexes

2012-01-06 Thread Cedric Greevey
On Fri, Jan 6, 2012 at 10:29 AM, Jonathan Cardoso 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.

Re: Sort a vector and keep the elements' indexes

2012-01-06 Thread Daniel Janus
(sort-by second (map-indexed vector [25 5 70])) -- 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

Sort a vector and keep the elements' indexes

2012-01-06 Thread Jonathan Cardoso
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