Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- (* Vérifier qu'un texte est un palindrome: *)
- let rec pal2(s) =
- if s = "" or string_length(s) = 1
- then true
- else
- if pr(s) <= `A` & pr(s) >= `Z`
- then pal2(char_of_int(int_of_char(pr(s)) + 32))
- else
- if dr(s) <= `A` & dr(s) >= `Z`
- then pal2(char_of_int(int_of_char(dr(s)) + 32))
- else
- if pr(s) = ` ` or pr(s) = `'` or pr(s) = `-` or pr(s) = `_` or pr(s) = `,`
- then pal2(sp(s))
- else
- if dr(s) = ` ` or dr(s) = `'` or dr(s) = `-` or dr(s) = `_` or dr(s) = `,`
- then pal2(sd(s))
- else
- if pr(s) = dr(s)
- then pal2(sp(sd(s)))
- else false;;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement