Recently, in November, we've had reason to clone the Rakudo Test.pm
and add an implementation (viklund++) of is_deeply, for testing
whether two arrays, pairs or hashes are deeply -- recursively --
equivalent. The method does what you'd think it does, checks the types
of its parameters and recurses as necessary.

With the rich set of equality testing operators in Perl 6...

 <http://www.dlugosz.com/Perl6/web/eqv.html>
 <http://perlcabal.org/syn/S03.html#Comparison_semantics>

...and given constructs like [+] and <+>, it's actually a bit
surprising to me that testing whether [1, [2, 3]] and [1, [2, 4]] are
the deeply equivalent isn't more easily expressed than it is. (Or
maybe it is easy with current constructs, and I missed it? Can't rule
that out.)

Couldn't an adverb to one or more of the existing equality operators
do this nicely? Something like this:

say [1, [2, 3]] eqv [1, [2, 4]] :deeply;

// Carl

Reply via email to