recursive equal, and firstDifference functions

timotheecour timothee.cour2 at gmail.com
Tue Mar 19 10:08:53 PDT 2013


I think none of you got the point of equalRecurse, so let me 
clarify.

equalRecurse should work on any type, not just inputRanges, see 
my example in the OT with a struct containing an array: currently 
std.algorithm.equal has isInputRange conditions on the arguments.

So, yes, it can go deep in practice (struct containing an array 
of struct, etc), unlike nesting ranges where it's not common in 
practice.

I wouldn't think it's that hard to do, at least for the common 
cases in practice.
Maybe what was confusing is that I wanted it in std.algorithm, 
but all functions in there operate on ranges, so maybe somewhere 
else, but I don't see a relevant package. Maybe a new 
std.algorithm2 for non-ranges?

Also, the OT's firstDifference would go there too, and I have a 
recursive (to specified level) toStringRecurse that would belong 
there too.


More information about the Digitalmars-d-learn mailing list