let tr_function s1 s2 = let translation = String.create 256 in for i = 0 to 255 do translation.[i] <- Char.chr i done; let l1 = String.length s1 - 1 and l2 = String.length s2 - 1 in let l12 = min l1 l2 in for i = 0 to l12 do translation.[Char.code s1.[i]] <- s2.[i] done; for i = l12+1 to l1 do translation.[Char.code s1.[i]] <- s2.[l12] done; fun c -> translation.[Char.code c];; |