def cut

bendtorch@1.3.0.0 · main.bend:2731

import bendtorch@1.3.0.0/main.bend as Bendtorch
import Base

2731# xs cut after its first n (a tail loop: a helper in the fork tree must not hold the stack)
2732def cut(-A: Type, n: Nat, xs: List<&1, A>, acc: List<&1, A>) -> Halves<A>:
2733  match n xs:
2734    case 1n+m Con{x, xt}:
2735      cut(A, m, xt, x <> acc)
2736    case _ _:
2737      Halves{List.reverse(&1, A, acc), xs}

Uses (4)

Used by (20)