in reply to Re^5: Derangements iterator (callbacks)
in thread Derangements iterator
But the iterator already existed. I find it easier to use the iterator to make a callback then to reimplement the algorithm recursively... (:
But enough good-natured intentionally talking at cross purposes... I was curious in what order your program produced the derangements and it told me:
b a d c b a d c b a d c b a d c ...
So I'll still keep my iterator-from-the-get-go. ;)
Update: If this "not too difficult" technique is too difficult for its own creator to correctly apply... And the point still stands that using an iterator via a call-back interface is trivial while using a call-back interface via an interator isn't even possible in stock Perl 5.
- tye
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^7: Derangements iterator (callbacks)
by Roy Johnson (Monsignor) on Jan 01, 2006 at 15:21 UTC |