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