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.
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.
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.
Re: why doesn't min take more than 1 parameter?
On 2021-01-02 06:47, L A Walsh wrote:
> trunc(min(3,1+log(1+line('$'))/log(10)))
>
> but I get E118: Too many arguments for function: min.
min() expects a single list-like argument so try
trunc(min([3,1+log(1+line('$'))/log(10)]))
which creates a list-literal with "3" as the first item and your 1+…
as the second element.
-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/20210102085725.3c7bc956%40bigbox.attlocal.net.
> trunc(min(3,1+log(1+line('$'))/log(10)))
>
> but I get E118: Too many arguments for function: min.
min() expects a single list-like argument so try
trunc(min([3,1+log(1+line('$'))/log(10)]))
which creates a list-literal with "3" as the first item and your 1+…
as the second element.
-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/20210102085725.3c7bc956%40bigbox.attlocal.net.
Re: why doesn't min take more than 1 parameter?
Just do ":help min()", it will tell you:
min({expr}) Return the minimum value of all items in {expr}.
{expr} can be a |List| or a |Dictionary|.
{expr} can be a |List| or a |Dictionary|.
So the simplest solution seems to be:
trunc(min([3, float2nr(1+log(1+line('$'))/log(10))]))
On Sat, 2 Jan 2021 at 22:49, L A Walsh <vim@tlinx.org> wrote:
I have the expression:
trunc(1+log(1+line('$'))/log(10))
to give me the width of the number columns when numbering is
on. Seems that it is reserving a minimum of 3 columns, so I tried
using the 'min' function:
trunc(min(3,1+log(1+line('$'))/log(10)))
but I get E118: Too many arguments for function: min.
huh? so how does one use 'min' to determine the lowest of 2 or
more numbers, or why doesn't the above work? :-(
*sigh*,
tnx
--
--
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/5FF08799.3040702%40tlinx.org.
--
Yongwei Wu
URL: http://wyw.dcweb.cn/
URL: http://wyw.dcweb.cn/
--
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/CADs46ifKSZWXycw-ft%2B-F8OFFLqcxcOFb9zasYSxta%3D3RDYSRw%40mail.gmail.com.
why doesn't min take more than 1 parameter?
I have the expression:
trunc(1+log(1+line('$'))/log(10))
to give me the width of the number columns when numbering is
on. Seems that it is reserving a minimum of 3 columns, so I tried
using the 'min' function:
trunc(min(3,1+log(1+line('$'))/log(10)))
but I get E118: Too many arguments for function: min.
huh? so how does one use 'min' to determine the lowest of 2 or
more numbers, or why doesn't the above work? :-(
*sigh*,
tnx
--
--
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/5FF08799.3040702%40tlinx.org.
trunc(1+log(1+line('$'))/log(10))
to give me the width of the number columns when numbering is
on. Seems that it is reserving a minimum of 3 columns, so I tried
using the 'min' function:
trunc(min(3,1+log(1+line('$'))/log(10)))
but I get E118: Too many arguments for function: min.
huh? so how does one use 'min' to determine the lowest of 2 or
more numbers, or why doesn't the above work? :-(
*sigh*,
tnx
--
--
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/5FF08799.3040702%40tlinx.org.
Friday, January 1, 2021
Re: exit from terminal OK?
> i started a :term from a gvim session to grep for a string, found the string
> and the module i wanted to edit, and from the terminal i started another
> gvim session to edit a 2nd file
>
> switching back to the 1st window i typed 'exit' in the terminal to end that,
> but it wouldn't end until i quit the 2nd gvim session
>
> is this the expected behavior? was i supposed to start my 2nd gvim with an
> ampersand at the end of the command?
The terminal is automatically closed when the job is finished. If you
start a child process, the parent process (the shell) will hang around
until the child is done. This the job isn't fully finished. You can
manually close the terminal though.
I think this is OK, although it might be unexpected that the terminal
window closes when the child process is done. And in this case any
output might be lost in the redraw.
To simulate the effect use this shell script:
#!/bin/sh
sleep 3
echo DONE NOW
And execute that from the shell, then type "exit".
--
hundred-and-one symptoms of being an internet addict:
77. The phone company asks you to test drive their new PBX system
/// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\
/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\ an exciting new programming language -- http://www.Zimbu.org ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///
--
--
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/202101011744.101Hieqs1588163%40masaka.moolenaar.net.
> and the module i wanted to edit, and from the terminal i started another
> gvim session to edit a 2nd file
>
> switching back to the 1st window i typed 'exit' in the terminal to end that,
> but it wouldn't end until i quit the 2nd gvim session
>
> is this the expected behavior? was i supposed to start my 2nd gvim with an
> ampersand at the end of the command?
The terminal is automatically closed when the job is finished. If you
start a child process, the parent process (the shell) will hang around
until the child is done. This the job isn't fully finished. You can
manually close the terminal though.
I think this is OK, although it might be unexpected that the terminal
window closes when the child process is done. And in this case any
output might be lost in the redraw.
To simulate the effect use this shell script:
#!/bin/sh
sleep 3
echo DONE NOW
And execute that from the shell, then type "exit".
--
hundred-and-one symptoms of being an internet addict:
77. The phone company asks you to test drive their new PBX system
/// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\
/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\ an exciting new programming language -- http://www.Zimbu.org ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///
--
--
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/202101011744.101Hieqs1588163%40masaka.moolenaar.net.
exit from terminal OK?
i started a :term from a gvim session to grep for a string, found the string
and the module i wanted to edit, and from the terminal i started another
gvim session to edit a 2nd file
switching back to the 1st window i typed 'exit' in the terminal to end that,
but it wouldn't end until i quit the 2nd gvim session
is this the expected behavior? was i supposed to start my 2nd gvim with an
ampersand at the end of the command?
gvim 8.2.2262
bash 4.4.23(1)
opensuse 15.2
--
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/CALfSX1ySRs44v7Kjge67d29YTVut%3D9S4kBgoGE5zFOjCuh3x2A%40mail.gmail.com.
Subscribe to:
Posts (Atom)