declare Fac S
fun {Fac N}
if N==0 then 1 else N*{Fac N-1} end
end
% {Browse {Fac 5} }
declare fun {Mul N R} % For n*(n-1)*...*(n-r+1)
local S = N-R+1 in
fun {Mul2 N S}
if N==S then N else N*{Mul2 N-1 S} end
end
end
end
declare fun {Comb N R}
if R==0 then 1 else {Mul N R} div {Fac R} end
end
declare
fun {Mul N R} % For n*(n-1)*...*(n-r+1)
local
S = N-R+1
fun {Mul2 N S}
if N==S then N else N*{Mul2 N-1 S} end
end
in
..call Mul2 here..
end
end