def split

bend-collections@1.0.0.0 · src/containers/deque.bend:31

import bend-collections@1.0.0.0/src/containers/deque.bend as Deque
import Base

31def split(~T: Data, n: Nat, xs: List<&2, T>) -> List<&2, T> & List<&2, T>:
32  match n xs:
33    case 0n ys:
34      (Nil{}, List.reverse(&2, T, ys))
35    case 1n+p Nil{}:
36      (Nil{}, Nil{})
37    case 1n+p Con{x, tail}:
38      split_cons(~T, x, split(~T, p, tail))

Uses (6)

Used by (2)