let mapi f v = let l = v.length in let r = create l false in for i = 0 to l - 1 do unsafe_set r i (f i (unsafe_get v i)) done; r