Ken Williams wrote:
[...]
BTW, Xavier & David both: The proposed interface for enumerating the set
partitions uses array refs, but sets in perl are more naturally
represented using hashes. I'd suggest re-implementing in terms of
hashes, or perhaps giving it a complete-enough OO interface that hides
the actual implementation structure.
My first thought was "well, just pass in the hash keys as the list".
Then I thought that that pushes a whole lot of make work code back onto
the client to reconstruct the subset hashes. So yes, you have a valid
point. It would be fairly trivial for me to stash the hash, and give the
clients what they want.
This would also explain why I named the module Set::Partition and not
List::Partition :)
All I would need to do is if (ref($in) eq 'HASH'), and take it from
there ... but my eyes have glazed over during the recent isa threads, so
I'm not sure what the current best practice is to detect a blessed hash.
Thanks,
David
--
"It's overkill of course, but you can never have too much overkill."