Saturday, January 2, 2021

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

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
>
> :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.

though a lot of vim stuff takes inspiration from
Python where min() is a vararg function letting
you do as the OP requests

min(arg1, arg2, arg3, arg4, …)

so it's a reasonable sort of hope/expectation.
It just doesn't happen to be a vim thing.

-tim




--
--
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/20210102100154.42d4f4df%40bigbox.attlocal.net.

No comments: