def group_elems
cli@0.2.0.0 · cli.bend:5232
import cli@0.2.0.0/cli.bend as Cli
import Base
5232
5233def group_elems(items: List<&2, Item>, +args: List<&2, Item>,
5234 +done: List<&2, String>) -> List<&2, Segment>:
5235 match items:
5236 case Nil{}: Nil{}
5237 case NeedOne{+group} <> tail:
5238 List.append(&2, Segment,
5239 group_elem(List.contains(~String, ~String.eq, done, group), args,
5240 group),
5241 group_elems(tail, args, group <> done))
5242 case head <> tail: group_elems(tail, args, done)