let map t ~f = let lgth = (length t) in if lgth = 0 then empty else begin let res = make lgth (S.get t 0) in for i = 0 to lgth - 1 do S.set res i (f (S.get t i)) done; res end