Tuesday, June 10, 2014

Re: Sorting a List of Numbers

Le mardi 10 juin 2014 à 07:15, Ben Klein a écrit:
> let numbers = [7, 9, 18, 12, 22]
> echo sort(numbers)
>
> [12, 18, 22, 7, 9]
>
> What's going on here? Is there some way by which I can sort these as
> Numbers and not Strings?


If you use "sort(numbers, 'MyCompare')" with "MyCompare()" define as
in the help for "sort()", it works well.

On the other hand, I'd say sorting numbers as strings is definitely a
bug in this situation.

Best,
Paul

--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment