Compare a list of strings: Difference between revisions
m
→{{header|Bruijn}}
imported>Arakov |
|||
(2 intermediate revisions by 2 users not shown) | |||
Line 677:
test1 lstC succeeds
test2 lstC fails</pre>
=={{header|Bruijn}}==
{{trans|Haskell}}
<syntaxhighlight lang="bruijn">
:import std/String .
all-eq? [land? (zip-with eq? 0 (tail 0))]
all-gt? [land? (zip-with lt? 0 (tail 0))]
# --- tests ---
list-a "abc" : ("abc" : {}("abc"))
list-b "abc" : ("def" : {}("ghi"))
:test (all-eq? list-a) ([[1]])
:test (all-eq? list-b) ([[0]])
:test (all-gt? list-a) ([[0]])
:test (all-gt? list-b) ([[1]])
</syntaxhighlight>
=={{header|C}}==
Line 2,708 ⟶ 2,730:
(formerly Perl 6)
In Raku, putting square brackets around an [[wp:Infix_notation|infix]] operator turns it into a listop that effectively works as if the operator had been
<syntaxhighlight lang="raku" line>[eq] @strings # All equal
|