Skip to content

Commit

Permalink
Update pl.pl
Browse files Browse the repository at this point in the history
  • Loading branch information
quartata committed Feb 10, 2017
1 parent 1c79c29 commit 1d37c30
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions pl.pl
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
}),
127=>(sub {}), # no-op
135=>(sub { $n = shift(@_); $k = shift(@_); return (factorial($n)/(factorial($k)*factorial($n-$k))); }), # combinations
137=>(sub { return pop%2; }), # parity
137=>(sub { return pop(@_) % 2; }), # parity
149=>(sub { return ord(pop); }), # ord
157=>(sub { $pointer++; skip(); return; }), # else
158=>(sub { $pointer = -1; return; }), # recurse
Expand Down Expand Up @@ -194,7 +194,7 @@ sub deref {

sub factorial {
if($_[0] == 0) { return 1; }
return reduce(sub {$a * $b}, 1..pop);
return reduce { $a * $b } 1..pop(@_);
}

# lazy trial division up to sqrt(n)
Expand All @@ -216,5 +216,5 @@ sub skip {
}

sub product {
return reduce(sub { $a * $b }, @_);
return reduce { $a * $b } @_;
}

0 comments on commit 1d37c30

Please sign in to comment.