Friday, June 18, 2010

Re: numbering lines in groups

On Jun 18, 1:57 am, John Little <john.b.lit...@gmail.com> wrote:
> On Jun 18, 6:29 am, Bee <200...@calcentral.com> wrote:
> > Please explain what you mean by the "tricky side effect semantics" as
> > I am learning.
>
> (Aren't we all?)   In the expression
>
>      @l + setreg('l', @l<str2nr(@n) ? @l+1 : 0 )
>
> the setting of the l register is a "side effect" of the evaluation of
> the expression, but the value of the expression could depend on this
> side effect.  If the expression is evaluated strictly left to right,
> the value of @l is taken and then changed, but if the setreg was done
> first the answer would be different.  The vim help says "All
> expressions within one level are parsed from left to right" but I
> could find no guarantee that it evaluates strictly left to right.

Thank you, John

I used your function version on a file of about 20k lines and it works
very well.

> A bit pedestrian, I imagine a modern approach would have a
> function object, but easy to follow, tweak, and debug, and can
> have comments

What do you mean by a "function object"?

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

No comments: