Re: A small programming problem
- From: cri@xxxxxxxx (Richard Harter)
- Date: Wed, 04 Oct 2006 04:44:17 GMT
On Wed, 04 Oct 2006 00:52:43 GMT, "John W. Krahn"
<someone@xxxxxxxxxxx> wrote:
Richard Harter wrote:[snip problem statement]
$ perl -le'
$a0 = [ "b0", "b1" ];
$s1 = [ $a0, "a1" ];
$S = [ "s0", $s1, "s2" ];
$P = do {
my $previous;
sub {
my $list = shift;
for my $item ( @$list ) {
$P->( $item ), next if ref $item eq "ARRAY";
$item .= $previous;
$previous = $item;
}
}
};
[snip data dumper]
If I follow this correctly (and I doubt it, perl is not one of my
languages) you're doing the same thing that mensanator did with the
python solution - you're neglecting the 'state' issue. An explanation
in words would be helpful.
.
- Follow-Ups:
- Re: A small programming problem
- From: John W. Krahn
- Re: A small programming problem
- References:
- A small programming problem
- From: Richard Harter
- Re: A small programming problem
- From: John W. Krahn
- A small programming problem
- Prev by Date: Re: A small programming problem
- Next by Date: Re: design decision nth item
- Previous by thread: Re: A small programming problem
- Next by thread: Re: A small programming problem
- Index(es):
Relevant Pages
|