It would be great if you can mention all the other books that you recomended during the series. To Mock a Mockingbird was an excelent sugestion. Specially seeing how combinator that seem so abstract in the book can be used for equational reasoning. Thank
for that suggestion.
It has been a great journey learning about functional programming in Haskell. To bad I’m going to be out of the country (no internet) for the last lecture
Just when I thought that this series couldn’t get better. Thanks Erick and Charles for putting so much effort into these lectures. Also, thanks to Dr. Hutton for taking the time to enlighten all of us.
2) Extend the parser for arithmetic expressions to support substraction and division, based upon the following extensions to the grammar:
expr ::= term (+ expr | - expr | e) term ::= factor (* term | / term | e)
expr' :: Parser Int expr' = do t <- term' do symbol "+" e <- expr' return (t + e) +++ do symbol "-" e <- expr' return (t - e) +++ return t term' :: Parser Int term' = do f <- factor' do symbol "*" t <- term' return (f * t) +++ do symbol
"/" e <- expr' return (f `div` e) +++ return f factor' :: Parser Int factor' = do symbol "(" e <- expr' symbol ")" return e +++ natural eval' :: String -> Int eval' xs = case parse expr' xs of [(n,[])] -> n [(_,out)] -> error ("unused input " ++ out) [] ->
error "invalid input"
2) Express the comprehension [f x | x <- xs, p x] using the functions map and filter.
mapfilter :: (a -> b) -> (a -> Bool) -> [a] -> [b] mapfilter f p = map f . filter p
3) Redefine map f and filter p using foldr.
map' :: (a -> b) -> [a] -> [b] map' f = foldr (\x v -> f x:v) [] filter' :: (a -> Bool) -> [a] -> [a] filter' p = foldr (\x v -> if p x then x:v else v) []
C9 Lectures: Dr. Erik Meijer - Functional Programming Fundamentals Chapter 13 of 13
Feb 05, 2010 at 2:29 PMErik,
It would be great if you can mention all the other books that you recomended during the series. To Mock a Mockingbird was an excelent sugestion. Specially seeing how combinator that seem so abstract in the book can be used for equational reasoning. Thank for that suggestion.
Here is the link: http://www.amazon.com/gp/product/0394534913/ref=oss_product
C9 Lectures: Dr. Erik Meijer - Functional Programming Fundamentals Chapter 12 of 13
Dec 18, 2009 at 9:55 AMWhile these lectures are coming to an end we can all look forward to the C9 letures on F#. Charles any idea when that's comming?
C9 Lectures: Dr. Erik Meijer - Functional Programming Fundamentals Chapter 12 of 13
Dec 17, 2009 at 10:51 AMIt has been a great journey learning about functional programming in Haskell. To bad I’m going to be out of the country (no internet) for the last lecture
C9 Lectures: Dr. Graham Hutton - Functional Programming Fundamentals Chapter 11 of 13
Dec 10, 2009 at 10:51 AMJust when I thought that this series couldn’t get better. Thanks Erick and Charles for putting so much effort into these lectures. Also, thanks to Dr. Hutton for taking the time to enlighten all of us.
C9 Lectures: Dr. Brian Beckman - Covariance and Contravariance in Physics 1 of 1
Dec 07, 2009 at 1:10 PMThanks for this wonderful lecture.
As a side effect
, the lecture and the paper gave me a good enough refresher on derivatives that I was able to solve project Euler’s problem 262. http://projecteuler.net/index.php?section=problems&id=262
C9 Lectures: Dr. Erik Meijer - Functional Programming Fundamentals Chapter 10 of 13
Dec 03, 2009 at 11:42 AMThese lectures have been the highlight of my Thursdays.
. Thanks for taking the time to produce them. I’m looking forward to see this lecture tonight.
C9 Lectures: Dr. Erik Meijer - Functional Programming Fundamentals Chapter 8 of 13
Nov 30, 2009 at 7:13 AMhomework:
2) Extend the parser for arithmetic expressions to support substraction and
division, based upon the following extensions to the grammar:
expr ::= term (+ expr | - expr | e)
term ::= factor (* term | / term | e)
expr' :: Parser Int expr' = do t <- term' do symbol "+" e <- expr' return (t + e) +++ do symbol "-" e <- expr' return (t - e) +++ return t term' :: Parser Int term' = do f <- factor' do symbol "*" t <- term' return (f * t) +++ do symbol "/" e <- expr' return (f `div` e) +++ return f factor' :: Parser Int factor' = do symbol "(" e <- expr' symbol ")" return e +++ natural eval' :: String -> Int eval' xs = case parse expr' xs of [(n,[])] -> n [(_,out)] -> error ("unused input " ++ out) [] -> error "invalid input"C9 Lectures: Dr. Erik Meijer - Functional Programming Fundamentals Chapter 7 of 13
Nov 30, 2009 at 7:09 AMhomework:
2) Express the comprehension [f x | x <- xs, p x] using the functions map and filter.
3) Redefine map f and filter p using foldr.
C9 Lectures: Dr. Erik Meijer - Functional Programming Fundamentals Chapter 8 of 13
Nov 19, 2009 at 6:55 PMExcelent lecture as always. Keep up the good work.
In the book Hutton didn't explain why he chose List instead of the Maybe type. I'm glad you touch that subject in the lecture.
C9 Lectures: Dr. Erik Meijer - Functional Programming Fundamentals Chapter 7 of 13
Nov 12, 2009 at 7:34 PMNice post Tom.
So much to learn.
See more comments…