tasks a-s

This commit is contained in:
Ingy döt Net 2013-04-10 23:57:08 -07:00
parent 47bf37c096
commit b83f433714
12433 changed files with 156208 additions and 123 deletions

View file

@ -0,0 +1,9 @@
let rev_string str =
let len = String.length str in
let res = String.create len in
let last = len - 1 in
for i = 0 to last do
let j = last - i in
res.[i] <- str.[j];
done;
(res)

View file

@ -0,0 +1,8 @@
let rev_string str =
let last = String.length str - 1 in
for i = 0 to last / 2 do
let j = last - i in
let c = str.[i] in
str.[i] <- str.[j];
str.[j] <- c;
done

View file

@ -0,0 +1,4 @@
let rec revs strin list index =
if List.length list = String.length strin
then String.concat "" list
else revs strin ((String.sub strin index 1)::list) (index+1)