Created
June 17, 2014 08:56
-
-
Save damncabbage/72d9a3b7859445576ac2 to your computer and use it in GitHub Desktop.
NICTA course exercises.
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
headOr :: a -> List a -> a | |
headOr d l = foldRight (\x y -> x) d l -- This anonymous function here is dumb. | |
product :: List Int -> Int | |
product l = foldRight (\x y -> x * y) 1 l | |
-- Alternative: | |
-- product l = foldRight (*) 1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment