Re: [CMS-PIPELINES] Cleanest "always read one record" segment?

2021-02-16 Thread Glenn Knickerbocker
On 2/16/2021 2:48 AM, Rob van der Heij wrote:
> When I'm really only taking a single sip, I see nothing wrong with 'peekto'
> and 'readto' in the loop, especially when you need it to detect EOF anyway.

This is for the case where I'm sipping an unknown number of records.  It
*should* never be zero, but I want to make sure I don't get stuck on the
same record forever if something goes wrong.  The extra VAR stage at the
start of the pipeline makes sure I'll always read at least one record,
even if I wind up discarding it.

¬R


Re: [CMS-PIPELINES] Cleanest "always read one record" segment?

2021-02-16 Thread Rob van der Heij
On Tue, 16 Feb 2021 at 00:19, Glenn Knickerbocker  wrote:

> What's your favorite thing to stick into a "sipping" pipeline so you
> know it will always consume at least one record and not worry about
> looping?  I have a nagging feeling I'm overlooking something obvious
> that's cheaper and safer than using VAR and trusting I know an unused name:
>
>   'callpipe *: | var gskjunk |' etc.
>
> CHOP|TAKE|HOLE seems like the "right" way but complicates the topology:
>

When I'm really only taking a single sip, I see nothing wrong with 'peekto'
and 'readto' in the loop, especially when you need it to detect EOF anyway.
But when there's more to sip, like discarding blank and comment records
before getting the next real payload record, the 'callpipe' approach is
attractive.

I recently fell in love with 'callpipe *: | pick to after 1 == // | stem
req. | l: lookup  ... '

Rob