37 lines
858 B
Text
37 lines
858 B
Text
$ENTRY Go {
|
|
= <Test 'rotor'>
|
|
<Test 'racecar'>
|
|
<Test 'RACEcar'>
|
|
<Test 'level'>
|
|
<Test 'rosetta'>
|
|
<Test 'A man, a plan, a canal: Panama'>
|
|
<Test 'Egad, a base tone denotes a bad age'>
|
|
<Test 'This is not a palindrome'>;
|
|
};
|
|
|
|
Test {
|
|
e.W, <Palindrome e.W> <InexactPalindrome e.W>: {
|
|
True s.1 = <Prout e.W ': exact palindrome'>;
|
|
s.1 True = <Prout e.W ': inexact palindrome'>;
|
|
False False = <Prout e.W ': not a palindrome'>;
|
|
};
|
|
};
|
|
|
|
InexactPalindrome {
|
|
e.W = <Palindrome <Filter ('ABCDEFGHIJKLMNOPQRSTUVWXYZ') <Upper e.W>>>;
|
|
};
|
|
|
|
Filter {
|
|
(e.Keep) = ;
|
|
(e.Keep) s.C e.W, e.Keep: {
|
|
e.1 s.C e.2 = s.C <Filter (e.Keep) e.W>;
|
|
e.1 = <Filter (e.Keep) e.W>;
|
|
};
|
|
};
|
|
|
|
Palindrome {
|
|
= True;
|
|
s.C = True;
|
|
s.C e.W s.C = <Palindrome e.W>;
|
|
e.X = False;
|
|
};
|