Palindrome detection: Difference between revisions

(fixed output of langur example line returns)
Line 2,174:
 
=={{header|Langur}}==
<lang Langur># String indexing is by code point (and 1-based), so .s[using len(.s)..1; ""] reverses by code points.
<lang Langur># removing spaces...
val .rsispal = f(.s) replace len(.s,) "> ",0 ""and .s == .s[len(.s)..1]
 
# String indexing is by code point, so .s[len(.s)..1; ""] reverses by code points.
# [... ; alternate] gives an alternate value in case of an invalid index (instead of an exception)
val .ispal = f(.s) len(.s) > 0 and .rs(.s) == .rs(.s[len(.s)..1 ; ""])
 
val .tests = h{
Line 2,194 ⟶ 2,190:
"solos": true,
"amanaplanacanalpanama": true,
"a man a plan a canal panama": truefalse, # true if we remove spaces
"ingirumimusnocteetconsumimurigni": true,
}
Line 2,208 ⟶ 2,204:
{{out}}
<pre>: false
a man a plan a canal panama: truefalse
aha: true
amanaplanacanalpanama: true
1,007

edits