recursive equal, and firstDifference functions

Jonathan M Davis jmdavisProg at gmx.com
Tue Mar 19 10:48:43 PDT 2013


On Tuesday, March 19, 2013 18:26:16 timotheecour wrote:
> > 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.
> 
> Also, I'd add to that list copyRecurse and some more, that
> operate on arbitrary types, not just ranges, so we have:
> 
> equalRecurse
> copyRecurse (deep copy)
> toStringRecurse
> firstDifference (see OT)
> toHashRecurse (should compare equal with a data structure
> serialized and then deserialized via a serialization function, eg
> std.orange)
> 
> I'm sure there's more.
> 
> that seems a starting point for a new package that operates on
> any type recursively (not just ranges), no?
> std.deep?std.recurse?
> Some of those could have a depth level compile time parameter
> that stops recursion at that level, which would be infinity by
> default.

And how do you even have the concept of recursion without some sort of range 
or container to recursively iterate through?

- Jonathan M Davis


More information about the Digitalmars-d-learn mailing list