[clean-list] My very first program crashes!

Maarten de Mol maartenm@cs.kun.nl
Mon, 28 May 2001 11:23:17 +0200


> I Downloaded latest CLEAN for Windows 98 and I managed to compile and
> run many of the included examples, including thecomplex ones (hanoi,
> scrabble). Then I tried my first program:
>
> --------------------------
> module test1
>
> import StdEnv
>
> pow x n
> |n==1 = x
> |otherwise = pow x n-1

Try exchanging "pow x n-1" by "pow x (n-1)".
Your current expression is interpreted as "(pow x n)-1",
because function application always binds higher than
'infix' application.

>
> Start = pow 3 2
> --------------------------
>
> It compiles without errors, launches the DOS console and immediately
> crashes (STACK FAULT). I even tried restarting my computer, erasing
> everything in "Clean System Files", compiling again, but it still
> crashes...
>

Cheers,
    Maarten de Mol