Binomial Coefficient

Author: L. Grondin

Number of ways to choose P objects among N. It's also the coefficient of the monome of degree P in the expansion of (1 + X)^N, thus the name.

N       (N-P+1)*(N-P+2)*...*N
(   ) = ∑ -------------------
  P         1*2*...*P

More

http://rosettacode.org/wiki/Evaluate_binomial_coefficients#Raku

Notable features used

  • infix sub definition

  • reduction meta-operator

  • self-declared parameters

  • sequence operator to get a decreasing order

  • Zip metaoperator with list of different sizes

  • use of rational numbers as a default

Source code: binomial-coefficient.pl

use v6;

sub infix:<choose> { [*] ($^n ... 0) Z/ 1 .. $^p }

say 5 choose 3;