3 ms·
You can always do something like: type optional_bytes = (Bytes.t * Bytes.t) let get i (data, mask) = match mask.[i] with | '\x00' -> None | _
by dpwm 8y ago
You can always do something like:
type optional_bytes = (Bytes.t * Bytes.t)
let get i (data, mask) =
match mask.[i] with
| '\x00' -> None
| _ -> Some data.[i]
If you need immutability and you're not changing often, you can use strings.
If you're using lists because you're doing all manner of comprehensions, you'd still be better iterating over the Bytes and rebuilding using a Buffer.