def split

bend-kit-concurrency@0.2.0.0 · concurrency.bend:34

import bend-kit-concurrency@0.2.0.0/concurrency.bend as Concurrency
import Base

34def split(-A: Type, xs: List<A>, n: Nat) -> List<A> & List<A>:
35  match xs n:
36    case Nil{} _:
37      (Nil{}, Nil{})
38    case h <> t 0n:
39      (Nil{}, h <> t)
40    case h <> t 1n+p:
41      split.cons(A, h, split(A, t, p))

Uses (5)

Used by (4)