I organized the head-to-tail list traversal idioms into three categories

So, this must have been done before, but it’s always good to do it again.

Mindful organization is mindful: List processing idioms

With diagram:

Actually fun how bad charted territoriy is slowly distilled into “oh there are just 4 cases… no, 3 cases!”:

  • Prepend to output list
  • Prepend to accumulator list
  • Append to accumulator list (aka. “use a difference list”)
1 Like