A Logiweb page defining a factorial function

Martin Røpcke

2. juni 2005

This document defines and tests a function for calculating the factorial of an integer. First we define then name of the page:

[factorial )^{pyk} “factorial”],

which we shall call fact. Having done this we next define the TEX rendering of the fact function, which is what decides how the text appears when using the function later on:

[x! )^{tex} “#1.!”].

Next we declare the value of the function:

[x! )^{val} x ≈ 0 | \begin{matrix}1 \\ x · x − 1! \end{matrix} ] ^{1}

And the test:

[1! ≈ 1]^{·}.

Another test:

[3! ≈ 6]^{·}.

1[x! )^{pyk} “∗ factorial”]