Monday, January 4, 2021

Re: why doesn't min take more than 1 parameter?

On 2021/01/02 08:01, Tim Chase wrote:
> On 2021-01-02 16:48, Tony Mechelynck wrote:
>
>> Using a single list-like argument is more general: it allows
>> determining the minimum of any number of values. If it accepted only
>> two Float arguments, then to determine the minimum of 8 values you
>> would have to do for instance
>>
----
I asked why it didn't seem to take more than one parameter.
That ':help min' shows min({list}), which really means
min([itema, itemb...]), is what was throwing me.
>> :let result = min(min(min(arg1, arg2), min(arg3, arg4)),
>> min(min(arg5, arg6), min(arg7, arg8)))
>>
>> while now you can do
>>
>> :let result = min([arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8])
>>
>> which is much more elegant.
>>
True. Even more elegant, might have been:
result = min(1,2,3,4,5,6,7,8);
( = 1)


On 2021/01/02 08:01, Tim Chase wrote:
> though a lot of vim stuff takes inspiration from
> Python ...
>
I think vim was around before python. vim would have drawn from
'vi' and, earlier, 'ed', sorta like early perl was an attempt to
mix early shell tools (sed, tr, sort, etc), with a shell like
language. Passing args in a list seems more like lisp -- maybe
drawing examples from emacs?


Hey, do you know how to determine the number of columns taken up by
fdc? Doesn't seem I can use fdc directly as a number though.

Thanks!






--
--
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.
To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/5FF39360.20002%40tlinx.org.

No comments: