Handbook
Glossary
factorial/ ( n k -- n!/k! )
Vocabulary
math
.
factorials
Inputs
n
an
object
k
an
object
Outputs
n!/k!
an
object
Definition
USING:
combinators
kernel
math
ranges
sequences
;
IN:
math.factorials
:
factorial/
( n k -- n!/k! )
{
{
[
dup
1
<=
]
[
drop
factorial
]
}
{
[
over
1
<=
]
[
nip
factorial
recip
]
}
[
2dup
<
[
t
]
[
swap
f
]
if
[
(a..b]
product
]
dip
[
recip
]
when
]
}
cond
;