define (fact n) :=
check {
(n less? 1) => 1
| else => (n times fact n minus 1)}
#why is (n minus 1) not needed?
#
#because precedence of minus is 200, times is 300,
#while precedence of fact is 110
#
(fact 4) # 24
(1 times fact 3 minus 2) # 1
(set-precedence fact 250)
(1 times fact 3 minus 2) # 4
# if we redefine fact, the new precedence
# would be used while parsing, so we would
# need parentheses around (n minus 1), otherwise:
define (fact n) :=
check {
(n less? 1) => 1
| else => (n times fact n minus 1)}
(fact 2) # diverges