in reply to Re: OO Algorithm::Diff (finally) released
in thread OO Algorithm::Diff (finally) released
Thanks!
The nature of the algorithm requires that the data end up in arrays. So supporting iterators would just be bolted on to the front. So for the case of file handles, you might as well just use:
my $diff = Algorithm::Diff->new( [<IN1>], [<IN2>] );
as that will be as efficient as possible.
For the case of other iterators, you might as well provide a general "iterate into a list" procedure that has nothing to do with Algorithm::Diff, for example:
so:sub cvIterToList { my $cvIter = shift( @_ ); my @list; my $item; while( defined( $item= $cvIter->() ) ) { push @list, $item; } return \@list; }
my $diff = Algorithm::Diff->new( cvIterToList($iter), [<IN>] );
But I could certainly add such to A::Diff anyway. What other types of iterators should I support? Perhaps that is enough since other cases can be covered simply enough with something like:
cvIterToList( sub { $obj->Next() } )
- tye
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: OO Algorithm::Diff (finally) released (iterators)
by diotalevi (Canon) on Sep 28, 2004 at 02:41 UTC | |
|
Re^3: OO Algorithm::Diff (finally) released (iterators)
by Aristotle (Chancellor) on Sep 28, 2004 at 08:33 UTC |