Created
September 20, 2014 04:44
-
-
Save katsuobushiFPGA/d5a1d65e94b9dd5837c3 to your computer and use it in GitHub Desktop.
Examples1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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