def take
import bend-osdev-bytes@0.1.1.0/bytes.bend as Bytesimport Base
59# the first n bytes (all of them if there are fewer)
60def take(n: Nat, xs: List<&2, U32>) -> List<&2, U32>:
61 match n:
62 case 0n:
63 Nil{}
64 case 1n+p:
65 match xs:
66 case Nil{}:
67 Nil{}
68 case Con{h, t}:
69 Con{h, take(p, t)}