let set s ~index ~v =     if index > length s - 1     then None     else Some (B.mapi (fun i c -> if i = index then v else c) s)