def prefix
import bend-collections@1.0.0.0/spec/crypto/chacha.bend as Chachaimport Base
130# The first n bytes of a list, and the rest.
131def prefix(n: Nat, xs: List<&2, U32>) -> List<&2, U32>:
132 match n xs:
133 case 0n _: Nil{}
134 case 1n+p Nil{}: Nil{}
135 case 1n+p x <> rest: x <> prefix(p, rest)