Saturday, January 2, 2021

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

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.

Best regards,
Tony.

--
--
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/CAJkCKXuGXH5cYEdBkk_SXqBcKQ8%3D%3DrTAjs7MDNDsN%3Di4vzawVA%40mail.gmail.com.

No comments: