17 lines
547 B
Text
17 lines
547 B
Text
define('pal(str)') :(pal_end)
|
|
pal str notany(&ucase &lcase) = :s(pal)
|
|
str = replace(str,&ucase,&lcase)
|
|
leq(str,reverse(str)) :s(return)f(freturn)
|
|
pal_end
|
|
|
|
define('palchk(str)tf') :(palchk_end)
|
|
palchk output = str;
|
|
tf = 'False'; tf = pal(str) 'True'
|
|
output = 'Palindrome: ' tf :(return)
|
|
palchk_end
|
|
|
|
* # Test and display
|
|
palchk('Able was I ere I saw Elba')
|
|
palchk('In girum imus nocte et consumimur igni')
|
|
palchk('The quick brown fox jumped over the lazy dogs')
|
|
end
|