mos_basik

CS 101c Lab02 Part A Question 8

Apr 29th, 2013
134
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. factorial :: (Num x, Ord x) => x -> x
  2. factorial a | a < 0 = error "Factorial not defined for negative numbers."
  3. factorial 0 = 1
  4. factorial a = a * (factorial (a - 1))
Advertisement
Add Comment
Please, Sign In to add comment