Re: {func} of sort()

2014-10-15 Fir de Conversatie Yasuhiro MATSUMOTO
I'm not talking about how you can do it. And I don't hope to discuss about MapSort. We should discuss how sort function is improvable to do it without copying your MapSort every time. On 10/16/14, Andy Wokula wrote: > Am 22.08.2014 um 02:05 schrieb mattn: >> It need to do like below with MapSort(

Re: {func} of sort()

2014-10-15 Fir de Conversatie 'Andy Wokula' via vim_dev
Am 22.08.2014 um 02:05 schrieb mattn: It need to do like below with MapSort() echo MapSort([{"foo":{"bar": "3"}}, {"foo":{"bar": "3 0"}}], '0 + v:val["foo"]["bar"]') If using my patch, it is possible easy to avoid this. :echo sort(["3 0", "3 0 1"], "a:lhs < a:rhs") I suppose your examples s

Re: {func} of sort()

2014-08-22 Fir de Conversatie Bram Moolenaar
John Little wrote: > On Friday, August 22, 2014 12:05:33 PM UTC+12, mattn wrote: > > > Bug in sort() function? > > > > See :help sort() > > > > > The sort is stable, items which compare equal (as number or as... > > There is indeed a bug in sort(). The stability of the sort is not relevant. >

Re: {func} of sort()

2014-08-21 Fir de Conversatie John Little
On Friday, August 22, 2014 12:05:33 PM UTC+12, mattn wrote: > > Bug in sort() function? > > See :help sort() > > > The sort is stable, items which compare equal (as number or as... There is indeed a bug in sort(). The stability of the sort is not relevant. I haven't been following the thread to

Re: {func} of sort()

2014-08-21 Fir de Conversatie mattn
> > We need to escape string to avoid to handle index as value. > I don't think so. > > I don't want to need to provide this function in all plugins. Just > > want to get it in official sort function. > The reason is: > :echo sort(['3 0', '3 0 1']) > ['3 0 1', '3 0'] > I'd expect ['3 0', '3

Re: {func} of sort()

2014-08-21 Fir de Conversatie 'Andy Wokula' via vim_dev
Am 21.08.2014 um 03:50 schrieb mattn: About making list sorted by string of one of value. echo "3" < "3 0" This is TRUE, then: echo MapSort([{"foo":{"bar": "3"}}, {"foo":{"bar": "3 0"}}], 'v:val["foo"]["bar"]') We expecet it should be kept: [{"foo":{"bar": "3"}}, {"foo":{"bar": "3 0"}}] But

Re: {func} of sort()

2014-08-20 Fir de Conversatie mattn
About making list sorted by string of one of value. echo "3" < "3 0" This is TRUE, then: echo MapSort([{"foo":{"bar": "3"}}, {"foo":{"bar": "3 0"}}], 'v:val["foo"]["bar"]') We expecet it should be kept: [{"foo":{"bar": "3"}}, {"foo":{"bar": "3 0"}}] But results are: [{'foo': {'bar': '3 0'}}

Re: {func} of sort()

2014-08-20 Fir de Conversatie 'Andy Wokula' via vim_dev
Am 19.08.2014 um 11:17 schrieb mattn: Keys? v:key is list index, it cannot contain spaces. Spaces in values shouldn't matter. Not sure what you mean. I wonder this won't works correctly. [{"a": "b"}, {"a b": ""}] Guessing you want to sort by dict key: :echo MapSort([{"a": "b"}, {"a b":

Re: {func} of sort()

2014-08-19 Fir de Conversatie mattn
> Keys? v:key is list index, it cannot contain spaces. > Spaces in values shouldn't matter. > Not sure what you mean. I wonder this won't works correctly. [{"a": "b"}, {"a b": ""}] -- -- You received this message from the "vim_dev" maillist. Do not top-post! Type your reply below the text you

Re: {func} of sort()

2013-11-06 Fir de Conversatie Andy Wokula
Am 06.11.2013 02:16, schrieb mattn: When keys or values contains space letter, I wonder it works correctly. Keys? v:key is list index, it cannot contain spaces. Spaces in values shouldn't matter. Not sure what you mean. -- Andy -- -- You received this message from the "vim_dev" maillist. Do

Re: {func} of sort()

2013-11-05 Fir de Conversatie mattn
When keys or values contains space letter, I wonder it works correctly. On Monday, November 4, 2013 2:39:26 AM UTC+9, Andy Wokula wrote: > Am 31.05.2013 15:14, schrieb mattn: > > > :echo sort([{"foo":3},{"foo":2},{"foo":4}], "v:lhs.foo - v:rhs.foo") > > > > What I use: > > > > " (copy) sort

Re: {func} of sort()

2013-11-03 Fir de Conversatie Andy Wokula
Am 31.05.2013 15:14, schrieb mattn: :echo sort([{"foo":3},{"foo":2},{"foo":4}], "v:lhs.foo - v:rhs.foo") What I use: " (copy) sort {list} by comparing strings obtained with {selexpr} func! MapSort(list, selexpr) " {list} list to sort " {selexpr}(string) expression to get a st

Re: {func} of sort()

2013-05-31 Fir de Conversatie ZyX
> Another benefit would be (as I remember) that it would be possible to > pass around Funcrefs to script-local functions and be able to just > invoke them in any scope without the current workarounds of expanding . Not this. Workaround with expanding was merged AFAIR and it does not matter much

Re: {func} of sort()

2013-05-31 Fir de Conversatie Ingo Karkat
On 31-May-2013 21:27 +0200, ZyX wrote: >> Using strings here was just a quick way of making it work. What we >> would really need is some kind of lambda function. So the argument >> would be one of three types: >> expression - mainly for backwards compatibility, but also allows >>

Re: {func} of sort()

2013-05-31 Fir de Conversatie ZyX
> Using strings here was just a quick way of making it work. What we > would really need is some kind of lambda function. So the argument > would be one of three types: > expression - mainly for backwards compatibility, but also allows >building the functionality from pi

Re: {func} of sort()

2013-05-31 Fir de Conversatie ZyX
пятница, 31 мая 2013 г., 20:39:15 UTC+4 пользователь mattn написал: > In addional, my patch don't remove feature that passing 'func name'. It would be better if it removed it. As I said, do make the difference between sort(list, 'Func') and sort(list, '{expr}') defined explicitely: sort(list, '{

Re: {func} of sort()

2013-05-31 Fir de Conversatie Bram Moolenaar
ZyX wrote: > пятница, 31 мая 2013 г., 17:14:17 UTC+4 пользователь mattn написал: > > Hi all. > > > > filter() or map() is given {string} expression to compare the items. But > > sort() is given function name or funcref for that. > > I hope to give expression to {func}. > > > > I guess this is

Re: {func} of sort()

2013-05-31 Fir de Conversatie Marc Weber
Not having read the implemeentation details: using expressions you can have "closures", using functions this is harder and requires much more typing. Whether this is important for sorting, I don't know. let sort_opts = {'ignore_spaces': 1} sort(foo, 'sort_stuff(v:1, v:2, sort_opts)') try the sam

Re: {func} of sort()

2013-05-31 Fir de Conversatie Yasuhiro MATSUMOTO
In addional, my patch don't remove feature that passing 'func name'. On 6/1/13, ZyX wrote: > пятница, 31 мая 2013 г., 17:14:17 UTC+4 пользователь mattn написал: >> Hi all. >> >> filter() or map() is given {string} expression to compare the items. But >> sort() is given function name or funcref fo

Re: {func} of sort()

2013-05-31 Fir de Conversatie Yasuhiro MATSUMOTO
Well, I do not want to define the function each time for sort. This is the opinion of the user. On 6/1/13, ZyX wrote: > пятница, 31 мая 2013 г., 17:14:17 UTC+4 пользователь mattn написал: >> Hi all. >> >> filter() or map() is given {string} expression to compare the items. But >> sort() is given

Re: {func} of sort()

2013-05-31 Fir de Conversatie ZyX
пятница, 31 мая 2013 г., 17:14:17 UTC+4 пользователь mattn написал: > Hi all. > > filter() or map() is given {string} expression to compare the items. But > sort() is given function name or funcref for that. > I hope to give expression to {func}. > > I guess this is useful to call sort(). > > :

Re: {func} of sort()

2013-05-31 Fir de Conversatie Ingo Karkat
On 31-May-2013 15:14 +0200, mattn wrote: > Hi all. > > filter() or map() is given {string} expression to compare the items. But > sort() is given function name or funcref for that. > I hope to give expression to {func}. > > I guess this is useful to call sort(). > > :echo sort([{"foo":3},{"foo

{func} of sort()

2013-05-31 Fir de Conversatie mattn
Hi all. filter() or map() is given {string} expression to compare the items. But sort() is given function name or funcref for that. I hope to give expression to {func}. I guess this is useful to call sort(). :echo sort([{"foo":3},{"foo":2},{"foo":4}], "v:lhs.foo - v:rhs.foo") [{'foo': 2}, {'foo