Palindrome detection: Difference between revisions

Content added Content deleted
(Picat: forgot the strip/1 function.)
Line 3,919: Line 3,919:
is_palindrome_inexact(N), number(N) => is_palindrome_inexact(N.to_string()).
is_palindrome_inexact(N), number(N) => is_palindrome_inexact(N.to_string()).
is_palindrome_inexact(S) =>
is_palindrome_inexact(S) =>
is_palindrome(strip(S)).</lang>
is_palindrome(strip(S)).


% convert to lowercase and
% skips punctuation and white space.
strip(S) = [C : C in S.to_lowercase(),
not C.membchk("!?,.;-_ \t\n()[]{}")].</lang>


{{out}}
{{out}}