src/ez/gate.bend
ezx@1.11.0.0 · 27 lines · 3 definitions
1
2
3
4
5
6
7import Base
8
9
10def want.put(is_want: Bool, line: String, rest: List<&2, String>) -> List<&2, String>:
11 match is_want:
12 case True{}:
13 String.drop(line, 2n) <> rest
14 case False{}:
15 rest
16
17
18def want(ls: List<&2, String>) -> List<&2, String>:
19 match ls:
20 case []:
21 []
22 case +h <> t:
23 want.put(String.starts_with(h, "#|"), h, want(t))
24
25
26def trailer(text: String) -> String:
27 String.join(want(String.lines(text)), "\n")