Deque.Deque.split: def of bend-kit-collections@0.1.4.1
Import: import bend-kit-collections@0.1.4.1/deque.bend as Deque
Lines 61-72 of bend-kit-collections@0.1.4.1/deque.bend: https://jend.leeeet.dev/read.txt?path=bend-kit-collections@0.1.4.1/deque.bend&start_line=61&end_line=72
import Base
# the first n elements, and the rest
def Deque.split(a, -A: Kind(a), n: Nat, xs: List) ->
List & List:
match n:
case 0n:
(Nil{}, xs)
case 1n+p:
match xs:
case Nil{}:
(Nil{}, Nil{})
case h <> t:
Deque.split.put(a, A, h, Deque.split(a, A, p, t))
Uses (5):
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=Base/base.bend&name=Pair
https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Sigma
https://jend.leeeet.dev/definition.txt?path=bend-kit-collections@0.1.4.1/deque.bend&name=Deque.split.put