let rev t = let lgth = length t in match lgth with | 0 -> empty | lgth -> let res = make lgth (String.get t 0) in for i = 0 to lgth - 1 do String.set res i (String.get t (lgth - 1 - i)) done; res