X-Git-Url: http://git.vpit.fr/?p=perl%2Fmodules%2FSub-Nary.git;a=blobdiff_plain;f=lib%2FSub%2FNary.pm;h=b6ad798ebbe50604af0198ef7d183e8ebb90e5f2;hp=50ba378034fa54a17ab6a2e4366926528aa3e52f;hb=f73405816c83f0e2816e81421a8b6cf72d5e3151;hpb=3ad0dc082fd7c56afdc76066a7f8c94c4ae28e69 diff --git a/lib/Sub/Nary.pm b/lib/Sub/Nary.pm index 50ba378..b6ad798 100644 --- a/lib/Sub/Nary.pm +++ b/lib/Sub/Nary.pm @@ -311,18 +311,20 @@ sub inspect_kids { $op = $op->first; redo; } - diag "> $n ($c)" if $DEBUG; + diag "> $n" if $DEBUG; my ($rc, $lc) = $self->inspect($op); + $c = 1 - count $r; + diag Dumper [ $c, $r, \@l, $rc, $lc ] if $DEBUG; $r = add $r, scale $c, $rc if defined $rc; - if ($rc and not defined $lc) { + if (not defined $lc) { @l = (); last; } push @l, scale $c, $lc; - $c *= count $lc if defined $lc; } - my $l = combine @l; +# diag Dumper \@l if $DEBUG; + my $l = scale +(1 - count $r), normalize combine @l; return $r, $l; }