LCD 47 <lcd...@gmail.com> wrote: > On 19 March 2014, Cade Forester <ahx2...@gmail.com> wrote: >> > Looks like you made a copy of f_sort() and modified it a bit. That's a >> > >> > lot of duplicate code. Better move the common stuff into a function >> > >> > that's used by both sort() and sortuniq(). >> >> Fixed > > How about separating it from sort()? That is, an uniq() function > that would remove duplicates from an already sorted list (results would > be undefined if the input list is not sorted). That would be consistent > with how uniq(1) works on UNIX.
uniq() should also make sense on non sorted list: it should remove adjacent identical items. This is consistent with the UNIX uniq or std::unique() in c++. In other words, I'd expect this for example: :echo uniq([1, 2, 3, 3, 2, 2, 1]) [1, 2, 3, 2, 1] I'm surprised this did not exist already. Dominique -- -- You received this message from the "vim_dev" 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_dev" group. To unsubscribe from this group and stop receiving emails from it, send an email to vim_dev+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.