This is similar to @Paul Keister's answer .
(mumble, mumble) years ago, the application I was working on had many variations of the so-called interrupt handling - all this logic, which involves splitting the sorted rows of data into groups and subgroups with headers and footers, since the application was written in LISP, we captured common idioms in a macro called WITH-CONTROL-BREAKS. If I were to port this syntax to an increasingly popular squiggly form, it might look something like this:
withControlBreaks (x, y, z : readSortedRecords()) { first (x) : { emitHeader(x); subcount = 0; } first (x, y) : { emitSubheader(x, y); zTotal = 0; } all (x, y, z) : { emitDetail(x, y, z); ztotal += z; } last (x, y) : { emitSubfooter(x, y, zTotal); ++subCount; } last (x) : { emitFooter(x, subcount); } }
In this modern age, with common SQL, XQuery, LINQ, etc., this need does not seem to arise as much as before. But from time to time I want to have this management structure.
WReach Dec 12 2018-10-12T00: 00Z
source share