def prefix

bend-collections-laws-crypto@1.0.0.0 · spec/crypto/chacha.bend:130

import bend-collections-laws-crypto@1.0.0.0/spec/crypto/chacha.bend as Chacha
import 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)

Uses (3)

Used by (19)