Skip to content

Instantly share code, notes, and snippets.

@katsuobushiFPGA
Created September 20, 2014 04:44
Show Gist options
  • Save katsuobushiFPGA/d5a1d65e94b9dd5837c3 to your computer and use it in GitHub Desktop.
Save katsuobushiFPGA/d5a1d65e94b9dd5837c3 to your computer and use it in GitHub Desktop.
Examples1
sum :: (Num a) => [a] -> a
sum [] = 0
sum (x:xs) = x + sum xs
product :: (Num a) => [a] -> a
product [] = 1
product (x:xs) = x * product xs
factorial :: Integer -> Integer
factorial 0 = 1
factorial x = x * factorial (x-1)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment