On Wed, 2005-11-30 at 02:16 -0500, Aaron Sherman wrote:
> Ronald J Kimball wrote:
>
> >my @indices = (0) x $maxlen;
> >
> >
> I have no idea why, because it's not more efficent or anything, but I
> always find myself writing:
>
> my @indices = map { 0 } 1..$maxlen;
I believe the latter is qui
On Wed, Nov 30, 2005 at 12:34:58PM -0500, Andrew Medico wrote:
> The anwser is that there is no such thing as a list of lists in Perl -
Don't forget the footnotes:
my @lol = map { [ $_ ] } (0 .. 7);
my $lol = [map { [ $_ ] } (0 .. 7)];
The former is a list of list refs and the latter is a list r
On Wed, 30 Nov 2005, Federico Lucifredi wrote:
> Hello Ron,
>
>
> > > Thanks Ron -- that works, but I don;t understand it... I thought x could
> > > be used only on quoted literals, I guess I was wrong there. On top of
> > > that, (0) x 4 should yield (0) (0) (0) (0) ... and generate a list of
> >
Hello Ron,
> > Thanks Ron -- that works, but I don;t understand it... I thought x could
> > be used only on quoted literals, I guess I was wrong there. On top of
> > that, (0) x 4 should yield (0) (0) (0) (0) ... and generate a list of
> > lists - or should it ?
> >
>
> Here's a question for
On Wed, Nov 30, 2005 at 11:24:24AM -0500, Federico Lucifredi wrote:
> On Wed, 2005-11-30 at 00:29 -0500, Ronald J Kimball wrote:
> > On Wed, Nov 30, 2005 at 12:24:47AM -0500, Federico Lucifredi wrote:
> > > On Wed, 2005-11-30 at 00:13 -0500, Ron Newman wrote:
> > >
> > > humm, that would give me a
On Wed, 2005-11-30 at 00:29 -0500, Ronald J Kimball wrote:
> On Wed, Nov 30, 2005 at 12:24:47AM -0500, Federico Lucifredi wrote:
> > On Wed, 2005-11-30 at 00:13 -0500, Ron Newman wrote:
> >
> > humm, that would give me a single element in $indices[0] equal to
> > "", while what we really want
Ronald J Kimball wrote:
>my @indices = (0) x $maxlen;
>
>
I have no idea why, because it's not more efficent or anything, but I
always find myself writing:
my @indices = map { 0 } 1..$maxlen;
The nice thing about it is that I tend to think of map even when I want
something very slightly diff
On Wed, Nov 30, 2005 at 12:24:47AM -0500, Federico Lucifredi wrote:
> On Wed, 2005-11-30 at 00:13 -0500, Ron Newman wrote:
>
> humm, that would give me a single element in $indices[0] equal to
> "", while what we really want is @indices[0..3] = (0,0,0,0)...
> except, of $maxlen length :)
>
>
On Wed, 2005-11-30 at 00:13 -0500, Ron Newman wrote:
> On Nov 30, 2005, at 12:03 AM, Federico Lucifredi wrote:
>
> > my $maxlen = 4;
> >
> > my @indices = (0, 0, 0, 0); # how do I init this array so that it is
> > $maxlen zeros long ?
>
humm, that would give me a single element in $indices[0] equ
On Wed, 2005-11-30 at 00:03 -0500, Federico Lucifredi wrote:
[...]
> the sub in an Iterator, it did not really answer what I wanted, so I
> wrote my own, and I am polishing my own.
>
your owning own own ? I think a YAWN might be in order. I am going to
bed 8)
-f
On Nov 30, 2005, at 12:03 AM, Federico Lucifredi wrote:
> my $maxlen = 4;
>
> my @indices = (0, 0, 0, 0); # how do I init this array so that it is
> $maxlen zeros long ?
my @indices = 0 x $maxlen;
>unless (++$i == $maxlen)
>{ last; } # can we get rid of some braces somehow ?!
Hello William,
I have perused HOP, but I find that, besides the gooi idea of wrapping
the sub in an Iterator, it did not really answer what I wanted, so I
wrote my own, and I am polishing my own.
The idea is as following: generating Strings (aka "Permutations with
Repetition) can be done using r
12 matches
Mail list logo