Resources to learn functional programming

Hi everyone, I'm fairly new to Haskell. I'm trying to learn it, but got stuck when i reached high-order functions. I understand what they are, but I cannot wrap my head on how they work, how to use them, and such. It seems so abstract to me. I tried to move on past it, but it only got harder and harder. Looks like I have problems learning functional programming. Do you have any good resources to learn functional programming? I am a decent C++ programmer. Thanks. Homero Cardoso de Almeida

I think that you should work your way through "Real World Haskell" which is available free online. I thought it was worth-while enough that I bought the book and I regularly refer to it. http://book.realworldhaskell.org/ Learn you a Haskell for Great Good is also a worth-while book. http://learnyouahaskell.com/ Good luck, Tim On Wed, Aug 1, 2012 at 1:53 PM, Homero Cardoso de Almeida < homerocda@gmail.com> wrote:
Hi everyone,
I'm fairly new to Haskell. I'm trying to learn it, but got stuck when i reached high-order functions. I understand what they are, but I cannot wrap my head on how they work, how to use them, and such. It seems so abstract to me. I tried to move on past it, but it only got harder and harder.
Looks like I have problems learning functional programming. Do you have any good resources to learn functional programming? I am a decent C++ programmer.
Thanks. Homero Cardoso de Almeida _______________________________________________ Beginners mailing list Beginners@haskell.org http://www.haskell.org/mailman/listinfo/beginners

I started with these two resources. I'd suggest beginning with "Learn You
a Haskell (for great good)." It's really great.
On Wed, Aug 1, 2012 at 2:23 PM, Tim Perry
I think that you should work your way through "Real World Haskell" which is available free online. I thought it was worth-while enough that I bought the book and I regularly refer to it. http://book.realworldhaskell.org/
Learn you a Haskell for Great Good is also a worth-while book. http://learnyouahaskell.com/
Good luck, Tim
On Wed, Aug 1, 2012 at 1:53 PM, Homero Cardoso de Almeida < homerocda@gmail.com> wrote:
Hi everyone,
I'm fairly new to Haskell. I'm trying to learn it, but got stuck when i reached high-order functions. I understand what they are, but I cannot wrap my head on how they work, how to use them, and such. It seems so abstract to me. I tried to move on past it, but it only got harder and harder.
Looks like I have problems learning functional programming. Do you have any good resources to learn functional programming? I am a decent C++ programmer.
Thanks. Homero Cardoso de Almeida _______________________________________________ Beginners mailing list Beginners@haskell.org http://www.haskell.org/mailman/listinfo/beginners
_______________________________________________ Beginners mailing list Beginners@haskell.org http://www.haskell.org/mailman/listinfo/beginners
-- David Hinkes

The books mentioned are great, but the resource that finally made the
concept of higher order functions concrete for me years ago was Joel
Spolsky's article on MapReduce "Can Your Programming Language Do
This?" (http://www.joelonsoftware.com/items/2006/08/01.html). The
examples are in Javascript, but that might mean you have less syntax
to worry about.
Lorcan
On Wed, Aug 1, 2012 at 10:38 PM, David Hinkes
I started with these two resources. I'd suggest beginning with "Learn You a Haskell (for great good)." It's really great.
On Wed, Aug 1, 2012 at 2:23 PM, Tim Perry
wrote: I think that you should work your way through "Real World Haskell" which is available free online. I thought it was worth-while enough that I bought the book and I regularly refer to it. http://book.realworldhaskell.org/
Learn you a Haskell for Great Good is also a worth-while book. http://learnyouahaskell.com/
Good luck, Tim
On Wed, Aug 1, 2012 at 1:53 PM, Homero Cardoso de Almeida
wrote: Hi everyone,
I'm fairly new to Haskell. I'm trying to learn it, but got stuck when i reached high-order functions. I understand what they are, but I cannot wrap my head on how they work, how to use them, and such. It seems so abstract to me. I tried to move on past it, but it only got harder and harder.
Looks like I have problems learning functional programming. Do you have any good resources to learn functional programming? I am a decent C++ programmer.
Thanks. Homero Cardoso de Almeida _______________________________________________ Beginners mailing list Beginners@haskell.org http://www.haskell.org/mailman/listinfo/beginners
_______________________________________________ Beginners mailing list Beginners@haskell.org http://www.haskell.org/mailman/listinfo/beginners
-- David Hinkes
_______________________________________________ Beginners mailing list Beginners@haskell.org http://www.haskell.org/mailman/listinfo/beginners

In a similar vein, I highly recommend "Higher Order Perl" by Mark-Jason Dominus. It presents most of these concepts in a more familiar setting. Don't worry if you don't know perl, if you know C++, you'll know enough to follow the book. Arthur -- Arthur Clune arthur@clune.org

Although many resources have been mentioned here, I'd like to
recommend "How To Design Programs", http://www.htdp.org/, which
approaches functional programming from a Scheme (Racket) perspective.
This book is how I learned functional programming and developed an
interest in Haskell.
In HTDP, higher order functions aren't introduced until you've been
taught how to write similar code without them. Then you learn that
your code can be abbreviated using things like map, foldl, foldr,
ormap, andmap, etc. The book moves into more complicated uses of
functions-as-data near the end.
Hope you find it useful,
Patrick
On Thu, Aug 2, 2012 at 4:03 AM, Arthur Clune
In a similar vein, I highly recommend "Higher Order Perl" by Mark-Jason Dominus. It presents most of these concepts in a more familiar setting. Don't worry if you don't know perl, if you know C++, you'll know enough to follow the book.
Arthur
-- Arthur Clune arthur@clune.org
_______________________________________________ Beginners mailing list Beginners@haskell.org http://www.haskell.org/mailman/listinfo/beginners

Thanks for all the suggestions.
I was learning Haskell through LYAHFGG, and that's when I got the problem
with Higher Order functions. I'll take a look at all the resources posted.
Thanks again,
Homero Cardoso de Almeida
On Thu, Aug 2, 2012 at 7:30 AM, Patrick Redmond
Although many resources have been mentioned here, I'd like to recommend "How To Design Programs", http://www.htdp.org/, which approaches functional programming from a Scheme (Racket) perspective. This book is how I learned functional programming and developed an interest in Haskell.
In HTDP, higher order functions aren't introduced until you've been taught how to write similar code without them. Then you learn that your code can be abbreviated using things like map, foldl, foldr, ormap, andmap, etc. The book moves into more complicated uses of functions-as-data near the end.
Hope you find it useful, Patrick
On Thu, Aug 2, 2012 at 4:03 AM, Arthur Clune
wrote: In a similar vein, I highly recommend "Higher Order Perl" by Mark-Jason Dominus. It presents most of these concepts in a more familiar setting. Don't worry if you don't know perl, if you know C++, you'll know enough to follow the book.
Arthur
-- Arthur Clune arthur@clune.org
_______________________________________________ Beginners mailing list Beginners@haskell.org http://www.haskell.org/mailman/listinfo/beginners
_______________________________________________ Beginners mailing list Beginners@haskell.org http://www.haskell.org/mailman/listinfo/beginners

On 1 August 2012 14:23, Tim Perry
I think that you should work your way through "Real World Haskell" which is available free online. I thought it was worth-while enough that I bought the book and I regularly refer to it. http://book.realworldhaskell.org/
Learn you a Haskell for Great Good is also a worth-while book. http://learnyouahaskell.com/
A very big +1 for this one. LYAHFGG really made it "click" for me. RWH is an excellent book too but more for subsequent reading (at least for me). (I recently bought both LYAHFGG and RWH. The decision to buy was made much easier by the fact that I was able to read them online first.)

And LYAHFGG is nice on the eyes.
On Wed, Aug 1, 2012 at 3:09 PM, Hilco Wijbenga
I think that you should work your way through "Real World Haskell" which is available free online. I thought it was worth-while enough that I bought
On 1 August 2012 14:23, Tim Perry
wrote: the book and I regularly refer to it. http://book.realworldhaskell.org/
Learn you a Haskell for Great Good is also a worth-while book. http://learnyouahaskell.com/
A very big +1 for this one. LYAHFGG really made it "click" for me. RWH is an excellent book too but more for subsequent reading (at least for me).
(I recently bought both LYAHFGG and RWH. The decision to buy was made much easier by the fact that I was able to read them online first.)
_______________________________________________ Beginners mailing list Beginners@haskell.org http://www.haskell.org/mailman/listinfo/beginners
-- David Hinkes

On 8/1/12 2:23 PM, Tim Perry wrote:
I think that you should work your way through "Real World Haskell" which is available free online. I thought it was worth-while enough that I bought the book and I regularly refer to it. http://book.realworldhaskell.org/
Learn you a Haskell for Great Good is also a worth-while book. http://learnyouahaskell.com/
The Haskell wikibook is also good, available online as HTML or PDF: http://en.wikibooks.org/wiki/Haskell Personally, I found that Learn You a Haskell started to get obscure at about the chapter on monads, just where the most clarity is needed, and that the wikibook was clearer. But different strokes for different folks. (I haven't looked at that section of Real-World Haskell yet.) -- Dudley

On Wed, Aug 01, 2012 at 05:53:36PM -0300, Homero Cardoso de Almeida wrote:
I'm trying to learn it, but got stuck when i reached high-order functions. [...] I am a decent C++ programmer.
The C++ analogy is as follows: a high-order function is a function that takes a parameter of a type that has an operator() defined (or returns a value of such a type). For example, find_if [1] is such a "high-order function". ---8<--- struct T { int i; }; class Predicate { public: bool operator()(const T& t) { return t.i == 23; } }; std::vector<T> ts; bool has23() { Predicate pred; return find_if(ts.begin(), ts.end(), pred) != ts.end(); } --->8--- In Haskell the analogous example would be: ---8<--- data T = T Int pred :: T -> Bool pred (T i) = i == 23 ts :: [T] has23 :: Bool has23 = isJust $ find pred ts --->8--- HTH Alex [1] http://www.sgi.com/tech/stl/find_if.html
participants (9)
-
Alexander Bernauer
-
Arthur Clune
-
David Hinkes
-
Dudley Brooks
-
Hilco Wijbenga
-
Homero Cardoso de Almeida
-
Lorcan McDonald
-
Patrick Redmond
-
Tim Perry