Skip to content

Instantly share code, notes, and snippets.

@gugod
Created October 4, 2021 11:51
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gugod/5be1cae591e6a6edc9d8d970b89a2e6d to your computer and use it in GitHub Desktop.
Save gugod/5be1cae591e6a6edc9d8d970b89a2e6d to your computer and use it in GitHub Desktop.
#!/usr/bin/env raku
sub postfix:<!>( Int $n ) { [*] (1..$n) }
sub prefix:<Σ>( *@nums ) { [+] @nums }
sub compute_this (Int $n) {
Σ (0..$n).map(
-> $r {
$n! / ($r! * ($n - $r)!)
}
)
}
say compute_this(9);
say compute_this(10);
say compute_this(11);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment