RFC - Data::SelectWithoutReplacement

2005-11-17 Thread David Landgren

People,

I have a simple module written and as far as I can tell, there's nothing 
on CPAN that does this. (Algorithm::Permute might, but it segfaults on 
my machine).


From the POD:

Data::SelectWithoutReplacement - Generate all subsets of a list of elements

=head1 VERSION

This document describes version 0.01 of Data::SelectWithoutReplacement,
released 2005-mm-dd.

=head1 SYNOPSIS

  use Data::SelectWithoutReplacement;

  my $d = Data::SelectWithoutReplacement-new( 3, 1, 4 );
  while (my $r = $d-next) {
print @$r\n;
  }

  # prints
  3 1 4
  1 4
  3 4
  4
  3 1
  1
  3

__END__

There are a few more goodies that I've thrown into the mix but my main 
question concerns the name. Is it good? Did you understand what the 
module would do when your saw the subject of this message in your inbox? 
Is there a better name(?:space)? for this?


(I rule out Algorithm::*, since the you're not actually supposed to care 
how it does its business, only that it does it).


Thanks for your input,
David



Re: RFC - Data::SelectWithoutReplacement

2005-11-17 Thread Philippe 'BooK' Bruhat
Le jeudi 17 novembre 2005 à 22:45, David Landgren écrivait:
 
 I have a simple module written and as far as I can tell, there's nothing 
 on CPAN that does this. (Algorithm::Permute might, but it segfaults on 
 my machine).
 
 From the POD:
 
 Data::SelectWithoutReplacement - Generate all subsets of a list of elements

What about Data::Subsets ? (and the empty list is a subset as well)

There is a Set:: top-level namespace, but Set::Subsets sounds odd.

   # prints
   3 1 4
   1 4
   3 4
   4
   3 1
   1
   3

Some people might like to receive the subsets ordered by size (ascending
or descending) or maybe only a subset of the subsets (!). Like for
instance, the 4 elements subsets of a 7 elements set.

Specific arguments to the constructor could do the trick.

-- 
 Philippe BooK Bruhat

 Your reputation is what you make of it... and what you choose to take with
 you.   (Moral from Groo The Wanderer #48 (Epic))


Re: RFC - Data::SelectWithoutReplacement

2005-11-17 Thread Xavier Noria

On Nov 17, 2005, at 22:45, David Landgren wrote:


People,

I have a simple module written and as far as I can tell, there's  
nothing on CPAN that does this. (Algorithm::Permute might, but it  
segfaults on my machine).


There are some modules dealing with this kind of stuff, with more  
generic interfaces. For instance Math::Combinatorics or  
Algorithm::Combinatorics.


-- fxn



Re: RFC - Data::SelectWithoutReplacement

2005-11-17 Thread Smylers
David Landgren writes:

 ... my main question concerns the name. Is it good? Did you understand
 what the module would do when your saw the subject of this message in
 your inbox? 

No.  And I still don't understand what WithoutReplacement means in
this context -- after reading those terms in the title, I was expecting
them to crop up again somewhere in the synopsis or the description.

The implication is that ordinarily when selecting something it is
replaced -- but I've no idea what that means.

 Is there a better name(?:space)? for this?

It looks to me that this module when given a set returns its power set:

  http://en.wikipedia.org/wiki/Power_set

so perhaps Data::PowerSet is appropriate.

Except that it isn't clear what your module does if the input list
contains duplicate items.  Sets can't contain duplicates; if your module
just sees a list with 5 items in it and permutes those items by their
indices then it wouldn't even notice the dupes, so obviously it isn't
(solely) working with sets.

But the module name is supposed to be best fit rather than perfect,
so even if your module also provides analogous behaviour on things that
aren't sets, I don't think that would bar it from using PowerSet in its
name.

 (I rule out Algorithm::*, since the you're not actually supposed to
 care how it does its business, only that it does it).

That's a good point, and I completely agree with you on it.

Smylers
-- 
May God bless us with enough foolishness to believe that we can make a
difference in this world, so that we can do what others claim cannot be done.



Linking to a POD document in POD

2005-11-17 Thread John Siracusa
How do I link to a POD document form within my POD in such a way that
search.cpan.org will make the correct link?  I tried doing this:

LMy::Foo

to link to My/Foo.pod in my module, but that doesn't work.  OTOH, that
syntax seems to work fine in some other modules I see on CPAN.  What am I
doing wrong?

Also, it there an easy way to see how search.cpan.org will treat my POD
without actually uploading to CPAN?

-John




Re: Linking to a POD document in POD

2005-11-17 Thread Ken Williams


On Nov 17, 2005, at 7:16 PM, John Siracusa wrote:


How do I link to a POD document form within my POD in such a way that
search.cpan.org will make the correct link?  I tried doing this:

LMy::Foo

to link to My/Foo.pod in my module, but that doesn't work.


`perldoc perlpod` seems to suggest that you've got the correct syntax.  
Is My::Foo in this case actually found at all by search.cpan.org?  
Where does the generated link go to?


 -Ken