Found in 14 comments on Hacker News
nightski · 2022-04-01 · Original thread
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.

[1] https://www.amazon.com/Pearls-Functional-Algorithm-Design-Ri...

[2] https://www.amazon.com/Purely-Functional-Data-Structures-Oka...

[3] https://www.amazon.com/Algorithm-Design-Haskell-Richard-Bird...

[4] https://www.amazon.com/Structure-Interpretation-Computer-Pro...

tel · 2016-11-30 · Original thread
In response only to the third point, there are some very nice examples of "advanced" equational reasoning in the work of Richard Bird. Pearls of Functional Algorithm Design [0] is a great book for exploring this and demonstrates a very "expert" nature.

[0]: https://www.amazon.com/Pearls-Functional-Algorithm-Design-Ri...

todd8 · 2016-10-09 · Original thread
Depending on your level of programming ability, one algorithm a day, IMHO, is completely doable. A number of comments and suggestions say that one per day is an unrealistic goal (yes, maybe it is) but the idea of setting a goal and working through a list of algorithms is very reasonable.

If you are just learning programming, plan on taking your time with the algorithms but practice coding every day. Find a fun project to attempt that is within your level of skill.

If you are a strong programmer in one language, find a book of algorithms using that language (some of the suggestions here in these comments are excellent). I list some of the books I like at the end of this comment.

If you are an experienced programmer, one algorithm per day is roughly doable. Especially so, because you are trying to learn one algorithm per day, not produce working, production level code for each algorithm each day.

Some algorithms are really families of algorithms and can take more than a day of study, hash based look up tables come to mind. First there are the hash functions themselves. That would be day one. Next there are several alternatives for storing entries in the hash table, e.g. open addressing vs chaining, days two and three. Then there are methods for handling collisions, linear probing, secondary hashing, etc.; that's day four. Finally there are important variations, perfect hashing, cuckoo hashing, robin hood hashing, and so forth; maybe another 5 days. Some languages are less appropriate for playing around and can make working with algorithms more difficult, instead of a couple of weeks this could easily take twice as long. After learning other methods of implementing fast lookups, its time to come back to hashing and understand when its appropriate and when alternatives are better and to understand how to combine methods for more sophisticated lookup methods.

I think you will be best served by modifying your goal a bit and saying that you will work on learning about algorithms every day and cover all of the material in a typical undergraduate course on the subject. It really is a fun branch of Computer Science.

A great starting point is Sedgewick's book/course, Algorithms [1]. For more depth and theory try [2], Cormen and Leiserson's excellent Introduction to Algorithms. Alternatively the theory is also covered by another book by Sedgewick, An Introduction to the Analysis of Algorithms [3]. A classic reference that goes far beyond these other books is of course Knuth [4], suitable for serious students of Computer Science less so as a book of recipes.

After these basics, there are books useful for special circumstances. If your goal is to be broadly and deeply familiar with Algorithms you will need to cover quite a bit of additional material.

Numerical methods -- Numerical Recipes 3rd Edition: The Art of Scientific Computing by Tuekolsky and Vetterling. I love this book. [5]

Randomized algorithms -- Randomized Algorithms by Motwani and Raghavan. [6], Probability and Computing: Randomized Algorithms and Probabilistic Analysis by Michael Mitzenmacher, [7]

Hard problems (like NP) -- Approximation Algorithms by Vazirani [8]. How to Solve It: Modern Heuristics by Michalewicz and Fogel. [9]

Data structures -- Advanced Data Structures by Brass. [10]

Functional programming -- Pearls of Functional Algorithm Design by Bird [11] and Purely Functional Data Structures by Okasaki [12].

Bit twiddling -- Hacker's Delight by Warren [13].

Distributed and parallel programming -- this material gets very hard so perhaps Distributed Algorithms by Lynch [14].

Machine learning and AI related algorithms -- Bishop's Pattern Recognition and Machine Learning [15] and Norvig's Artificial Intelligence: A Modern Approach [16]

These books will cover most of what a Ph.D. in CS might be expected to understand about algorithms. It will take years of study to work though all of them. After that, you will be reading about algorithms in journal publications (ACM and IEEE memberships are useful). For example, a recent, practical, and important development in hashing methods is called cuckoo hashing, and I don't believe that it appears in any of the books I've listed.

[1] Sedgewick, Algorithms, 2015. https://www.amazon.com/Algorithms-Fourth-Deluxe-24-Part-Lect...

[2] Cormen, et al., Introduction to Algorithms, 2009. https://www.amazon.com/s/ref=nb_sb_ss_i_1_15?url=search-alia...

[3] Sedgewick, An Introduction to the Analysis of Algorithms, 2013. https://www.amazon.com/Introduction-Analysis-Algorithms-2nd/...

[4] Knuth, The Art of Computer Programming, 2011. https://www.amazon.com/Computer-Programming-Volumes-1-4A-Box...

[5] Tuekolsky and Vetterling, Numerical Recipes 3rd Edition: The Art of Scientific Computing, 2007. https://www.amazon.com/Numerical-Recipes-3rd-Scientific-Comp...

[6] https://www.amazon.com/Randomized-Algorithms-Rajeev-Motwani/...

[7]https://www.amazon.com/gp/product/0521835402/ref=pd_sim_14_2...

[8] Vazirani, https://www.amazon.com/Approximation-Algorithms-Vijay-V-Vazi...

[9] Michalewicz and Fogel, https://www.amazon.com/How-Solve-Heuristics-Zbigniew-Michale...

[10] Brass, https://www.amazon.com/Advanced-Data-Structures-Peter-Brass/...

[11] Bird, https://www.amazon.com/Pearls-Functional-Algorithm-Design-Ri...

[12] Okasaki, https://www.amazon.com/Purely-Functional-Structures-Chris-Ok...

[13] Warren, https://www.amazon.com/Hackers-Delight-2nd-Henry-Warren/dp/0...

[14] Lynch, https://www.amazon.com/Distributed-Algorithms-Kaufmann-Manag...

[15] Bishop, https://www.amazon.com/Pattern-Recognition-Learning-Informat...

[16] Norvig, https://www.amazon.com/Artificial-Intelligence-Modern-Approa...

scriptdevil · 2016-07-23 · Original thread
As a person who is finally getting time to read papers in this field, I came across a Stack Overflow post [1] about newer functional data structures recently when looking for papers to put on my kindle for a long trip. The top answer to it has a tonne of links.

Tangentially related, but I am currently reading Pearls of Functional Algorithm Design [2] - It is fascinatingly well written (though it isn't strictly about data structures only).

I plan to read Fun of Programming [3] next which has a chapter on binary heap trees by Okasaki but the rest of the topics aren't quite about data structures.

[1] http://cstheory.stackexchange.com/questions/1539/whats-new-i... [2] http://www.amazon.in/Pearls-Functional-Algorithm-Design-Rich... [3] https://www.cs.ox.ac.uk/publications/books/fop/

tel · 2015-02-24 · Original thread
If you like this then you should check out the source, Richard Bird's book [0] for it and many other similar examples.

[0] http://www.amazon.com/Pearls-Functional-Algorithm-Design-Ric...

chollida1 · 2014-10-19 · Original thread
For those of you who aren't familiar with the author's other works, it's worth taking a peek at his other books.

I can whole heatedly recommend Pearls of Functional Algorithm Design http://www.amazon.com/Pearls-Functional-Algorithm-Design-Ric...

It's a good cross between two other excellent books:

- Jon Bentley's Programming Pearls http://www.amazon.com/Programming-Pearls-2nd-Jon-Bentley/dp/...

and

- Chris Okasaki's Purely Function Data Structures http://www.amazon.com/Purely-Functional-Structures-Chris-Oka....

If you haven't read all three, its well worth your while to do so!

And of course if you are going down the rabbit hole of reading Perls of Functional Algorithm Design then you need to read the "how to read Pearls of Functional Algorithm design" as well.

http://www.atamo.com/blog/how-to-read-pearls-by-richard-bird...

radicality · 2014-07-20 · Original thread
"Pearls of functional algorithm design" [0] is a fantastic book if you are interested in some more equational reasoning, I highly recommend it.

[0] http://www.amazon.co.uk/Pearls-Functional-Algorithm-Design-R...

fredyr · 2014-05-19 · Original thread
Richard Bird, Philip Wadler - Introduction to Functional Programming http://www.amazon.com/Introduction-Functional-Programming-In...

Richard Bird - Pearls of Functional Algorithm Design http://www.amazon.com/Pearls-Functional-Algorithm-Design-Ric...

Christian Queinnec - Lisp in Small Pieces http://www.amazon.com/Lisp-Small-Pieces-Christian-Queinnec/d...

tel · 2014-04-05 · Original thread
While LYAH is a lot of fun, if you've gotten your feet wet with Haskell for a while and want to see some really powerful examples of "functionally solving problems" I cannot recommend more highly Richard Bird's "Pearls of Functional Algorithm Design"[0].

All of the "Functional Pearls" papers are worth a read, but Bird's book is such a compressed, convenient, powerful collection of advanced functional problem solving style that I think anyone interested in "thinking" functionally should strive to read it.

It's not exactly for the faint of heart, to be clear. Bird's idea is that we can establish certain mathematical rules which allow us to transform "the simplest thing which could possibly be correct" to an efficient program through a series of steps, each one maintaining correctness as an invariant.

[0] http://www.amazon.com/Pearls-Functional-Algorithm-Design-Ric...

tel · 2014-01-08 · Original thread
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.

[1] http://www.amazon.com/Pearls-Functional-Algorithm-Design-Ric...

jcurbo · 2013-09-19 · Original thread
Same here, I came in to post about that exact book.

There's also Pearls of Functional Algorithm Design which I have yet to read. http://www.amazon.com/Pearls-Functional-Algorithm-Design-Ric...

In general you've got stuff like Introduction to Algorithms (http://www.amazon.com/Introduction-Algorithms-Thomas-H-Corme...) and the Algorithm Design Manual (http://www.amazon.com/Algorithm-Design-Manual-Steven-Skiena/...) both of which I have seen mentioned as good books. I'm in a grad school-level algorithms class that just started using the former (which is language agnostic, but we are doing our implementations in Java) and it looks pretty good to me.

gtani · 2013-02-01 · Original thread
Everybody has a different list of a dozen intermed/advanced topics ;-}

http://www.reddit.com/r/haskell/comments/17gavl/what_you_con...

http://stackoverflow.com/questions/5778436/what-haskell-topi...

And most of those are fast moving topics these days but they're well covered in blogs, the Cafe list, stackoverflow, they just need to be collated/cataloged. At a minimum some wiki farming would address a lot of those. Unfortunately, I emailed the wiki contact a couple times about pitching in and never got response.

___________________

There's a few books you could look at, tho they're more building out what's in RWH, not up:

draft by Snoyman https://github.com/mezzohaskell/mezzohaskell

Bird's Functional algorithm pearls http://www.amazon.com/Pearls-Functional-Algorithm-Design-Ric...

http://haskell.cs.yale.edu/wp-content/uploads/2013/01/HSoM3....

JA Alonso has another book of exercises (in Spanish http://www.cs.us.es/~jalonso/publicaciones/Piensa_en_Haskell...

also the FP in Scala (Morris, Chiusano, Bjarnason) may include some haskell code, I haven't read yet, but definitely covers a lot of these hot topics

http://manning.com/bjarnason/

gtani · 2012-12-16 · Original thread
I think haskell has more orthogonal language features than, say, java, where everything holds together pretty well but you can't un-congeal features and use by themselves.

Besides GHCi this is my reference shelf

- http://www.cl.cam.ac.uk/~ns441/files/thips.pdf

- http://acm.wustl.edu/functional/hs-breads.php

___________

- http://www.haskell.org/hoogle/

- http://www.haskell.org/haskellwiki/Typeclassopedia

- Prelude source and http://www.haskell.org/onlinereport/haskell2010/haskellch9.h...

_______________

- 2010, 98 reports (which are very readable, unstiff/undry docs

- use google to search stackoverflow/questions/tagged/haskell

- http://ezyang.com/haskell.html

____________

Books: Hudak's "School of Music" (tho I'm not sure how interesting it is unless you know how to read/play music), and the 3 books by Hutton, Thompson, and Bird. It has been remarked that the "gentle Intro" is actually kind of harsh, the Hutton and Thompson books really are gentle intro's:

http://www.haskell.org/tutorial/

http://haskell.cs.yale.edu/euterpea-2/haskell-school-of-musi...

http://www.amazon.com/Pearls-Functional-Algorithm-Design-Ric...

I have read a few chapters of this very beautiful book by Richard Bird called "Pearls of Functional Algorithm Design": http://www.amazon.com/Pearls-Functional-Algorithm-Design-Ric...

You should definitely check it out. If you already know Haskell and you love algorithms, that book will probably be more interesting than the Intro to Haskell book.

Also check out Okasaki's book of functional data structures: http://www.amazon.com/Purely-Functional-Structures-Chris-Oka...

Fresh book recommendations delivered straight to your inbox every Thursday.