News for hackers. Stuff that matters.
Re:Unix system programming in OCaml (2014) by dpwm on Thursday July 12, 2018 @07:31AM (#17513555)
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.

There are no comments on this comment yet.