Palindrome detection: Difference between revisions

Content added Content deleted
m (→‎{{header|Haskell}}: Added a comment to a version better suited to indexed arrays than to linked lists.)
Line 2,602: Line 2,602:
See the C palindrome_r code for an explanation of the concept used in this solution,
See the C palindrome_r code for an explanation of the concept used in this solution,
though it may be better suited to indexed arrays than to linked lists.
though it may be better suited to indexed arrays than to linked lists.

(last is expensive, and entails multiplied recursions over the right hand side
(last is expensive, and entails multiplied recursions over the right hand side
of the remaining list here).
of the remaining list here).


<lang haskell>is_palindrome_r x | length x <= 1 = True
<lang haskell>is_palindrome_r x | length x <= 1 = True