Exhibit 3 | Industrial FP: a case study | Stephen Taylor | Vector 21.3

Exhibit 3: Alternative ending to parseFile

     nstacks←1∘↓¨¨∘{(crs∘(re¨))onflat ⍵}            ⍝ nesting stacks: discard initial 1
     heads bodies←separate segment crlf lineate ⍵   ⍝ retain segment structure (segs are truncated)
     stacks←nstacks heads                           ⍝ nesting stacks
     namshp←{⊃{(2↓⍺)(fshp ⍵)}/2↑'('part ⍵}          ⍝ field name and shape
     names shapes←flip flip¨namshp¨¨heads           ⍝ field names and shapes
     full←bodies fretby¨×/¨¨stacks,¨¨shapes         ⍝ undo truncations and fret to fields

     ⊃∘(,/)¨stacks names shapes full                ⍝ remove segment structure
 }