views:

508

answers:

5

I have just finished reading Little Schemer.. Now I am planning on reading Purely Functional Data Structures.. but the notations in the book looks very complicated.. are there easier alternative to this book that talk about data structure in functional languages.. if not then what do I need to read before I can start on this book...

Thanks

Update: It turns out that I was looking at the author's dissertation. I just checked out the book is more friendlier (thanks nlucaroni)

+1  A: 

Disclaimer: I'm a co-author on the book, although I'm mostly just editing...

You might be interested in Real World Functional Programming by Tomas Petricek and myself. It's aimed primarily at C# developers (your SO history looks appropriate) who want to code in a more functional way. We give examples in C# where possible, and also introduce F#. You can download the first chapter (an old version at the moment, I'm afraid) for free, and although the book hasn't been published yet there's an early access programme (MEAP) which will let you have the chapters as we write/edit them.

Jon Skeet
shahkalpesh
The plan is for the book to come out in August, but I've no idea at the moment whether that's realistic or not. I don't know much about Amanda's book, but I suspect it will be good. It really depends on whether you want to know about functional programming in general or F# in particular.
Jon Skeet
+5  A: 

I am currently reading Purely Functional Data Structures, doing all the exercises et cetera. I have been programming ocaml for about a year, so it has been pretty straight forward for me --a few little things here and there with differences between ML and OCAML module and functor signatures that I had to get used to, but it was pretty natural.

I would say learn some introductory ML/OCaml/F# stuff on pattern matching and type signatures, and a bit on modules and functors. Make sure you aren't afraid of recursion as well. Everything I've been exposed to has been done with matching and recursion, and interpreting the type signatures. Building the modules he describes is really an optional task.

I was being silly and neglected some necessary information for defining a functor, and posted some of the code for chapter II on stack overflow. What will also help is looking at the implementations of the data structures already written in ocaml within the standard library.

Also, make sure you are using his book and not his dissertation, as he had to neglect many data structures and introductions in his dissertation since they were not his original work. Also, the source code that is accompanied by the book on Chris' web page (in Haskell and ML), also Ocaml.

Slashdot has a book review with more information if anyone is interested.

Also, post questions here! Good luck!

nlucaroni
A: 

PFDS isn't that bad, really. The notation, as I recall, is just ML. Some exposure to it, or Haskell, should make all the code easy enough to read.

Jay Kominek
+1  A: 

If I were you, I'd start with "How to Design Programs". Since you have read "The Little Schemer" you can probably skim some chapters. However HtDP teaches important lessons on how the shape of data dictates the shape of your code. Don't underestimate the importance of the recipes in HtDP!

Now in order to read Okasaki's wonderful book, you only need to learn enough Haskell syntax to understand how constructors and pattern matching are written.

Then most of the code can be ported in a straightforward manner to, say, PLT Scheme. Porting is especially easy if you use a pattern matching library such as "match".

Scheme versions of several of Okasaki's data structures can be found here:

http://planet.plt-scheme.org/package-source/soegaard/galore.plt/1/0/

PS: If you are completely new to the world of data structures, you'll also need an introduction to amortization.

soegaard
+2  A: 

The main new things with Okasaki are ML notation, algebraic data types, and pattern matching. If you liked the Little Schemer then a natural place to get up to speed on the foundations of ML would be The Little MLer.

Norman Ramsey