On Wed, 2024-03-27 at 23:57 -0400, Graydon Saunders wrote:
> 
> 
> What's the appropriate pattern for "process a sequence, toggling an
> action on or off based on the last member of the sequence we looked
> at?"

One approach might be to use fold-left on (1 to count($input)), with
$input in scope, so that you can write in the function argument to
fold-left things like

  if (. eq 1) then $input[.]
  else if (starts-with($input[. - 1], 'stab') then...

etc

liam


-- 
Liam Quin, https://www.delightfulcomputing.com/
Available for XML/Document/Information Architecture/XSLT/
XSL/XQuery/Web/Text Processing/A11Y training, work & consulting.
Barefoot Web-slave, antique illustrations:  http://www.fromoldbooks.org

Reply via email to