Lambda the Ultimate

inactiveTopic Book Review: Purely Functional Data Structures
started 3/3/2004; 10:26:42 AM - last post 3/7/2004; 8:26:47 AM
Chris Rathman - Book Review: Purely Functional Data Structures  blueArrow
3/3/2004; 10:26:42 AM (reads: 8374, responses: 16)
Book Review: Purely Functional Data Structures
Since Ehud needs a bit lighter material to shade himself through the day, what better than a slashdot discussion to fill that hole. The book reviewed is Purely Functional Data Structures by Chris Okasaki. Was first mentioned sometime ago on LtU.

(Of course, book reviews are somewhat like movie reviews - if you haven't seen the movie, it's hard to discuss - and if you have seen the movie you already know the ending).
Posted to functional by Chris Rathman on 3/3/04; 10:28:03 AM

Frank Atanassow - Re: Book Review: Purely Functional Data Structures  blueArrow
3/3/2004; 11:01:21 AM (reads: 709, responses: 1)
Of course, book reviews are somewhat like movie reviews - if you haven't seen the movie, it's hard to discuss

Fortunately, most Slashdot readers will not regard this as an obstacle.

Mark Evans - Re: Book Review: Purely Functional Data Structures  blueArrow
3/3/2004; 12:51:11 PM (reads: 676, responses: 2)

My favorite feature of LtU is that it's not Slashdot, no matter how hard it tries to foment language wars.

The present topic inspired these lucid Slashdot remarks:

Nice to see some actual content on Slashdot!

I am now a graduate student. I love comp-sci for what it actually is....Why am I replying to a troll??? Oh well, I feel better now.

andrew cooke - Re: Book Review: Purely Functional Data Structures  blueArrow
3/3/2004; 12:55:30 PM (reads: 678, responses: 0)
hey, leave my dear readers alone! :o)

actually, the responses have been pretty positive - a few people who've also read the book agreed, which was nice.

i was worried someone here would point out some big error in what i wrote, but really it's so vague and general that i think i'm pretty safe. not sure that's a good thing.

Ehud Lamm - Re: Book Review: Purely Functional Data Structures  blueArrow
3/3/2004; 1:29:06 PM (reads: 661, responses: 1)
PFDS was mentioned and disucssed a couple of times on LtU. I even think I wrote a mini review once...

It's a must read if you want to master FP.

Ehud Lamm - Re: Book Review: Purely Functional Data Structures  blueArrow
3/3/2004; 1:52:19 PM (reads: 651, responses: 0)
I even think I wrote a mini review once...

I can't find it anywhere, so I guess I was just dreaming it up. Oh, the heat..

Tayssir John Gabbour - Re: Book Review: Purely Functional Data Structures  blueArrow
3/3/2004; 7:26:02 PM (reads: 601, responses: 2)
Is there any reason why hashtables should not be covered well in the book?

Incidentally, Slashdot comments are actually quite good if you use the right heuristics:

Threshold: 3
Funny:    -2
Small comment penalty: 100 bytes, -1
Long comment bonus:    300 bytes, +1

Mark Evans - Re: Book Review: Purely Functional Data Structures  blueArrow
3/3/2004; 8:28:58 PM (reads: 578, responses: 0)
PDF download.

andrew cooke - Re: Book Review: Purely Functional Data Structures  blueArrow
3/4/2004; 4:17:40 AM (reads: 509, responses: 1)
hastables are covered, in that there's an implementation outlined (exercise 10.11).

since you cannot index into a mutable array (well, you could, but mutable arrays themselves are a no-no) you have to implement them using tree-like structures (to get O(logn) updates) and these are described in detail. the point of ex 10.11, if i understand it correctly, is that you use the hash as the initial index, rather than the key itself.

what more would you want the book to say? (i'm not being rude - thinking about that question helped me see why they're treated as they are).

ps i haven't looked at the thesis text (or, at least, not for a long time), but i don't think it's identical to the book. it would be an odd thesis if it was! but maybe much of the difference is in the presentation - the "meat" could be the same.

Ehud Lamm - Re: Book Review: Purely Functional Data Structures  blueArrow
3/4/2004; 4:54:19 AM (reads: 490, responses: 0)
It's not identical to the book. (Which was the reason I bought the book in the first place..)

Mark Evans - Re: Book Review: Purely Functional Data Structures  blueArrow
3/4/2004; 9:01:30 AM (reads: 432, responses: 0)
No I didn't think so but still.

Neel Krishnaswami - Re: Book Review: Purely Functional Data Structures  blueArrow
3/4/2004; 1:44:09 PM (reads: 389, responses: 2)
Regarding hashtables: Okasaki's book has one of the prettiest presentations of red-black trees I've ever seen. The only thing missing is a nice delete function (I had to synthesize one from CLR).

These days, however, randomized treaps as my balanced tree of choice. It's so simple you can understand what's going on just from the code, without even drawing pictures!

Isaac Gouy - Re: Book Review: Purely Functional Data Structures  blueArrow
3/5/2004; 12:15:30 PM (reads: 259, responses: 1)
Treaps in Java (citeseer was unreachable for a moment)

Oleg - Re: Book Review: Purely Functional Data Structures  blueArrow
3/5/2004; 12:39:54 PM (reads: 254, responses: 0)
Or more efficient Treaps in Scheme
http://pobox.com/~oleg/ftp/Scheme/index.html#treaps

The notes in the title comments to the source code explain the more efficient insertion and deletion operations. The version of the code in the Scheme Untergrund library is more polished:
http://savannah.nongnu.org/cgi-bin/viewcvs/sunterlib/sunterlib/scsh/treaps/

Darius Bacon - Re: Book Review: Purely Functional Data Structures  blueArrow
3/7/2004; 1:40:25 AM (reads: 175, responses: 1)
With all this talk of treaps I ought to link to some counter-propaganda for weight-balanced trees: they provide all the same operations (I believe) in the same space, asymptotic time, and simple coding, plus they're purely functional and they don't need randomness.

Isaac Gouy - Re: Book Review: Purely Functional Data Structures  blueArrow
3/7/2004; 8:26:47 AM (reads: 167, responses: 0)
"Bottom line: Which binary search tree is best for your application? Probably the balanced tree for which you have the best implementation readily available... Which flavor of balanced tree is probably not as important as how good the programmer was who coded it."
p178 The Algorithm Design Manual

Toby Reyelts - Re: Book Review: Purely Functional Data Structures  blueArrow
3/7/2004; 9:32:37 PM (reads: 127, responses: 0)
Isaac wrote:

> Treaps in Java

Treaps sound interesting, but I have a hard time reading an article that tries to compare treaps to hashtables - that's apples and oranges. I would have had more respect for the author if they had tried to compare treaps with say, red-black trees.

The article is old, (written in 97), so arguments that it uses for using a treap over Java's standard collections are out of date. I wouldn't recommend this to someone without the caveat that its mostly useful for decribing what a treap is - not why you would use one.