def unreverse
import near-v-framework@0.4.0.0/domain/architecture/system/deployment/nix_darwin/effects.bend as Effectsimport Base
17# Lines of a program's output. Base's String.lines recurses once per character, which overflows the
18# stack on `launchctl list` (about 20 KB); this walks the text in a loop, keeping each line reversed.
19def unreverse(xs: List<&2, String>, acc: List<&2, String>) -> List<&2, String>:
20 match xs:
21 case []:
22 acc
23 case x <> rest:
24 unreverse(rest, String.reverse(x) <> acc)