fun badFactorial n = if n < 0 then 0 (* pick something here *) else if n = 0 then 1 else n * (badFactorial (n-1)); exception NegativeNumberException; fun factorial n = if n < 0 then raise NegativeNumberException else if n = 0 then 1 else n * (factorial (n-1));