Reply to comment

Partial function application (currying) and other bits

It seems to me that currying is to functional programming what encapsulation/information hiding is to OOP. It gives you a way to really reduce rather large and unwieldy functions to a reusable prototype.

Something else that also struck me as rather powerful was how Haskell (almost effortlessly) composes generic functions, giving ways for them to work together with a variety of types in situations that would seem rather odd or unruly in an OOP sense. The book examples are a bit contrived... how often are you going to need to count the number of words starting with a capital letter? But the idea that these functions are actually composed of list operator functions + an isUpper check is very nifty, and not at all how you'd do it in an imperative world.

A note about the book specifically... this chapter had almost too much information. They cover a broad arc of functional techniques in machine gun fashion. I'm sure it's more to get exposure so you can start thinking in those techniques, but trying to read the chapter in one sitting is nearly impossible.

Reply

The content of this field is kept private and will not be shown publicly.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd> <blockquote>
  • Lines and paragraphs break automatically.
  • You may post PHP code. You should include <?php ?> tags.
  • Web page addresses and e-mail addresses turn into links automatically.
  • You can enable syntax highlighting of source code with the following tags: <code>, <blockcode>, <cpp>. The supported tag styles are: <foo>, [foo]. PHP source code can also be enclosed in <?php ... ?> or <% ... %>.
  • Images can be added to this post.

More information about formatting options

CAPTCHA
This question is for testing whether you are a human visitor and to prevent automated spam submissions.
20 + 0 =
Solve this simple math problem and enter the result. E.g. for 1+3, enter 4.