Euphoria
Ticket #508:
std/utils.e should have all_equal()
-
Reported by
jimcbrown
Dec 06, 2010
This would be an easy way to compare all elements of a sequence.
Single element sequences would return true (an element will equal itself) and the empty sequence also returns true.
public function all_equals(sequence s)
for i = 1 to length(s) - 1 do
if not equal(s[$],s[i]) then
return 0
end if
end for
return 1
end function
Details
1. Comment by mattlewis
Dec 06, 2010
A potential workaround / implementation:
not length( find_all_but( my_seq[1], my_seq, 2 ) )
Note that this doesn't check for an empty sequence.
2. Comment by jeremy
Jan 03, 2011
Assigned to 4.0.1 milestone