tricu

An interpreted language for exploring Tree Calculus
Log | Files | Refs | README | LICENSE

keep-data-line.scp (484B)


      1 -- Optional-valued mapper fixture for mapMaybe and computed-tree matching.
      2 -- The practical data-lines demo uses filter plus data-line.scp instead.
      3 -- Keep nonempty lines except those beginning with '#' (ASCII 35).
      4 -- Input: a line list; state ignored. A retained line is returned verbatim as
      5 -- stem line, including any CR or leading space.
      6 consumer keepDataLine
      7   []                      @ _ => leaf
      8   [35 | rest]             @ _ => leaf
      9   as whole [first | rest] @ _ => stem whole