Pearls of Functional Algorithm Design

Category: Programming
Author: Richard Bird
All Hacker News 14


by nightski   2022-04-04
You should not approach problems in functional languages with imperative techniques. It's fitting a square peg in a round hole. The approaches & data structures aren't always the same.

In my experience with FP you start with more of a top down approach in contrast to the bottom up approach discussed in the blog post.

There are many good resources on this. I've referenced a few below. Of course there are many more.





by anonymous   2018-08-01
@user633183 unfortunately, no; I saw it in the book itself, [Pearls of Functional Algorithm Design]( the "look inside" can be searched for "foldrn" (the definition is on pg.42).
by anonymous   2017-10-15
by tel   2017-08-19
If you like this then you should check out the source, Richard Bird's book [0] for it and many other similar examples.


by tel   2017-08-19
It's worth noting that Djikstra (to my understanding) thought almost none of that was even contained in the field of CS. His perspective was that CS was about process and verification and proof and thus while the current implementation of computers is interesting, it didn't deserve any privilege.

So being able to prove certain nice properties about algorithms without worrying about the underlying implementation is exactly what Djikstra believed important and something that Haskell does allow you to do... even if the result is abysmal performance.

It's worth noting as well that there's a whole wonderful book [1] that provides a great glimpse of good Haskell style with the conceit that one should program the most abysmally slow correct thing first and then use algebraic theories to transform it along obviously correct paths to something highly performant.


by radicality   2017-08-19
"Pearls of functional algorithm design" [0] is a fantastic book if you are interested in some more equational reasoning, I highly recommend it.