Handbook
Glossary
alternating-factorial ( n -- m )
Vocabulary
math
.
factorials
Inputs
n
an
object
Outputs
m
an
object
Definition
USING:
kernel
math
ranges
sequences
;
IN:
math.factorials
:
alternating-factorial
( n -- m )
dup
1
>
[
[
[1..b]
]
keep
even?
[
[
odd?
]
]
dip
[
=
]
curry
compose
[
[
[
factorial
]
]
]
dip
[
bi
[
neg
]
when
]
curry
compose
map-sum
]
[
drop
1
]
if
;