Lists.sort.go: def of bend-lint-api@0.2.0.0 Import: import bend-lint-api@0.2.0.0/shared/lists.bend as Lists Lines 86-102 of bend-lint-api@0.2.0.0/shared/lists.bend: https://jend.leeeet.dev/read.txt?path=bend-lint-api@0.2.0.0/shared/lists.bend&start_line=86&end_line=102 import Base # Passes until one run is left; each pass halves the runs, so `fuel` (the length) is more than enough. def sort.go( ~A: Data, ~le: A -> A -> Bool, fuel: Nat, +n: Nat, runs: List<&2, List<&2, A>> ) -> List<&2, A>: match fuel runs: case _ Nil{}: [] case _ Con{r, Nil{}}: r case 0n _: concat(&2, A, runs) case 1n+f _: sort.go(~A, ~le, f, n, sort.pass(~A, ~le, n, runs, [])) Uses (5): https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Bool https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=List https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Nat https://jend.leeeet.dev/definition.txt?path=bend-lint-api@0.2.0.0/shared/lists.bend&name=concat https://jend.leeeet.dev/definition.txt?path=bend-lint-api@0.2.0.0/shared/lists.bend&name=sort.pass