Re: [R-pkg-devel] Workaround for code/documentation mismatch

2021-08-11 Thread Andrew Simmons
Hello, @Martin Maechler: %until% and %while% use R's builtin repeat function. Something like do(expr) %until% (cond) repeat { expr if (cond) break } are identical. After %until% and %while% check the arguments look correct, it makes a call to repeat like above and evaluates it

Re: [R-pkg-devel] Workaround for code/documentation mismatch

2021-08-11 Thread Duncan Murdoch
On 10/08/2021 11:25 p.m., Andrew Simmons wrote: Hello, I've written two functions to emulate do while/until loops seen in other languages, but I'm having trouble documenting its usage. The function is typically used like: do ({ expr1 expr2 ... }) %while% (cond) so I want to

Re: [R-pkg-devel] Workaround for code/documentation mismatch

2021-08-11 Thread Martin Maechler
> Hello, > > I've written two functions to emulate do while/until loops seen in other > languages, but I'm having trouble documenting its usage. The function is > typically used like: > > do ({ > expr1 > expr2 > ... > }) %while% (cond) I understand that you did *not* ask .. but

Re: [R-pkg-devel] Workaround for code/documentation mismatch

2021-08-10 Thread Andrew Simmons
When not preceded by an expression wrapped in do(), %while% would throw an error "do while loop must begin with 'do'". The function %while% looks like `%while%` <- function (expr, cond) invisible(.Call(C_do.while, substitute(expr), substitute(cond), parent.frame())) and the corresponding C

Re: [R-pkg-devel] Workaround for code/documentation mismatch

2021-08-10 Thread Hugh Parsonage
What is the behaviour of %while% if not preceded by an expression wrapped in do() ? On Wed, 11 Aug 2021 at 1:26 pm, Andrew Simmons wrote: > Hello, > > > I've written two functions to emulate do while/until loops seen in other > languages, but I'm having trouble documenting its usage. The

[R-pkg-devel] Workaround for code/documentation mismatch

2021-08-10 Thread Andrew Simmons
Hello, I've written two functions to emulate do while/until loops seen in other languages, but I'm having trouble documenting its usage. The function is typically used like: do ({ expr1 expr2 ... }) %while% (cond) so I want to document it something like: do(expr) %while% (cond)