Start reading Purely Functional Data Structures on the free Kindle Reading App or on your Kindle in under a minute. Don't have a Kindle? Get your Kindle here.
Programming Books C Java PHP Python Learn more Browse Programming Books

Deliver to your Kindle or other device

Enter a promotion code
or gift card
 
 
 

Try it free

Sample the beginning of this book for free

Deliver to your Kindle or other device

Sorry, this item is not available in
Image not available for
Color:
Image not available

To view this video download Flash Player

 

Purely Functional Data Structures [Kindle Edition]

Chris Okasaki
4.5 out of 5 stars  See all reviews (12 customer reviews)

Digital List Price: $40.00 What's this?
Print List Price: $49.99
Kindle Price: $26.00
You Save: $23.99 (48%)

Free Kindle Reading App Anybody can read Kindle books—even without a Kindle device—with the FREE Kindle app for smartphones, tablets and computers.

To get the free app, enter your email address or mobile phone number.

Formats

Amazon Price New from Used from
Kindle Edition $26.00  
Hardcover $90.56  
Paperback $34.65  
Shop the New Digital Design Bookstore
Check out the Digital Design Bookstore, a new hub for photographers, art directors, illustrators, web developers, and other creative individuals to find highly rated and highly relevant career resources. Shop books on web development and graphic design, or check out blog posts by authors and thought-leaders in the design industry. Shop now

Book Description

Most books on data structures assume an imperative language like C or C++. However, data structures for these languages do not always translate well to functional languages such as Standard ML, Haskell, or Scheme. This book describes data structures from the point of view of functional languages, with examples, and presents design techniques so that programmers can develop their own functional data structures. It includes both classical data structures, such as red-black trees and binomial queues, and a host of new data structures developed exclusively for functional languages. All source code is given in Standard ML and Haskell, and most of the programs can easily be adapted to other functional languages. This handy reference for professional programmers working with functional languages can also be used as a tutorial or for self-study.


Editorial Reviews

Review

"This book is important because it presents data structures from the point of view of functional languages...a handy reference for professional functional programmers...Most of the programs can easily be adapted to other functional languages. Even C and Java programmers should find implementing these data structures a relatively straightforward process...Programs are physically well structured and readable, and are displayed in boxes. Okasaki has produced a valuable book about functional programming, exploring a wide range of data structures...a significant contribution to the computer science literature." Computing Reviews

Book Description

Most books on data structures assume an imperative language like C or C++. However, data structures for these languages do not always translate well to functional languages such as Standard ML, Haskell, or Scheme. This book describes data structures and data structure design techniques from the point of view of functional languages. It includes code for a wide assortment both of classical data structures and of data structures developed exclusively for functional languages.This handy reference for professional programmers working with functional languages can also be used as a tutorial or for self-study.

Product Details

  • File Size: 6060 KB
  • Print Length: 232 pages
  • Simultaneous Device Usage: Up to 4 simultaneous devices, per publisher limits
  • Publisher: Cambridge University Press (April 13, 1998)
  • Sold by: Amazon Digital Services, Inc.
  • Language: English
  • ASIN: B00AKE1V04
  • Text-to-Speech: Enabled
  • X-Ray:
  • Word Wise: Not Enabled
  • Lending: Not Enabled
  • Amazon Best Sellers Rank: #129,048 Paid in Kindle Store (See Top 100 Paid in Kindle Store)
  •  Would you like to give feedback on images?.


Customer Reviews

Most Helpful Customer Reviews
129 of 130 people found the following review helpful
5.0 out of 5 stars An elegant book March 30, 2005
Format:Paperback
Okasaki's slim volume is one of the best expositions on implementing data structures & algorithms in a functional language. After taking an introductory course on functional programming, this would be the book which tells you where to go next.

This book doesn't just present a rehash/rewrite of imperative data structures, only written in a functional language. Instead, Okasaki makes sure to emphasize benefits which only functional programming can bring to the table. For example, many functional data structures can compactly represent not just their current state, but all of their past states as well--a feature called "Persistence". Also, functional newbie programmers might be wondering why lazy vs. strict programming is a big deal, and Okasaki shows clearly where data structures can benefit from either being lazy or being strict.

For the advanced reader, Okasaki also presents several powerful techniques for analyzing the runtime of algorithms, including the so-called "Banker's Method" and the "Physicist's Method" for analyzing amortized algorithms.

I hope that Okasaki comes out with a 2nd edition of this book; there is one missing piece in particular which I really wish he would have included: Although he presents an EXTREMELY lucid description of how to implement Red-Black trees in a functional language, he only presented algorithms for insertion and querying. Of course, deletion from a red-black tree is the hardest part, left here, I suppose, as an exercise to the student. If you want to supply this missing piece yourself, check out a paper by Stefan Kars, "Red-black trees with types", J. Functional Programming 11(4):425-432, July, 2001.
Read more ›
Was this review helpful to you?
17 of 17 people found the following review helpful
5.0 out of 5 stars One of my favorite computer science books November 17, 2010
Format:Paperback
[This review copied from my moribund blog at [...] ]

The typical data structures most programmers know and use require imperative programming: they fundamentally depend on replacing the values of fields with assignment statements, especially pointer fields. A particular data structure represents the state of something at that particular moment in time, and that moment only. If you want to know what the state was in the past you needed to have made a copy of the entire data structure back then, and kept it around until you needed it. (Alternatively, you could keep a log of changes made to the data structure that you could play in reverse until you get the previous state - and then play it back forwards to get back to where you are now. Both these techniques are typically used to implement undo/redo, for example.)

Or you could use a persistent data structure. A persistent data structure allows you to access previous versions at any time without having to do any copying. All you needed to do at the time was to save a pointer to the data structure. If you have a persistent data structure, your undo/redo implementation is simply a stack of pointers that you push a pointer onto after you make any change to the data structure.

This can be quite useful--but it is typically very hard to implement a persistent data structure in an imperative language, especially if you have to worry about memory management [1]. If you're using a functional programming language--especially a language with lazy semantics like Haskell--then all your data structures are automatically persistent, and your only problem is efficiency (and of course, in your functional languages, the language system takes care of memory management).
Read more ›
Was this review helpful to you?
13 of 13 people found the following review helpful
4.0 out of 5 stars Haskell speakers may be daunted. June 2, 2010
Format:Paperback|Verified Purchase
Despite the editorial description of the book, the book is really about Standard ML. It happens to have an appendix where source code has been translated -- out of order, and without reference to the text -- into Haskell. This makes it very difficult to read through the book without speaking Standard ML.

The exercises, also, are only SML. Several appear to use idiosyncratic SML features -- I say "appear" because no answers to the exercises, even the basic ones, are provided for me to check my understanding.

Essentially, the content is good, but expect to learn Standard ML to really get the most out of this book.
Was this review helpful to you?
55 of 67 people found the following review helpful
4.0 out of 5 stars Strange choice of implementation languages November 6, 2006
Format:Paperback
The description of the book says it includes source code in both ML and Haskell. Unfortunately, the body of the text uses ML exclusively, and the Haskell code is banished to an appendix.

I say "unfortunately", because many of the data structures used depend on lazy evaluation, which comes quite naturally to Haskell, and seems to require some sort of non-standard extension in ML.

While the content is good, I wish it would have used Haskell as the primary exposition language.
Was this review helpful to you?
33 of 42 people found the following review helpful
4.0 out of 5 stars Hash Tables are included, briefly. November 24, 2001
By A Customer
Format:Paperback
A correction to another review: Hash Tables are included, briefly.
Comment | 
Was this review helpful to you?
9 of 10 people found the following review helpful
5.0 out of 5 stars The Design Patterns of FP June 24, 2011
Format:Paperback|Verified Purchase
I'm not going to lie; I didn't make it through the second 2/3rds of this book. But that first third did more for my understanding of functional programming than the rest of my FP library did combined. This book seems to me to be the functional programming answer to Design Patterns. It's worth having on your shelf if you have any interest in functional programming, ML, or Haskell.
Comment | 
Was this review helpful to you?
Most Recent Customer Reviews
5.0 out of 5 stars A timeless classic; will never be irrelevant
Okasaki's book on purely functional data structures is a timeless classic.

Every programmer -- functional or otherwise -- should have a copy at arm's length. Read more
Published 3 months ago by Matt
5.0 out of 5 stars Wisdom for advanced programmers
In the pantheon of knowledge there are increasing levels of value; data, information, knowledge and wisdom. Read more
Published 10 months ago by Aidan J. Delaney
4.0 out of 5 stars Good, but a bit dense
This book is great for someone who already understands the basics of functional programming but wants to learn more. Read more
Published on December 5, 2009 by Amazon Customer
5.0 out of 5 stars Theoretically Interesting and Practically Useful
I use this book all the time to implement and improve purely functional data-structures. It is amazing the performance improvements possible by using good data-structures in... Read more
Published on May 1, 2009 by Jay McCarthy
5.0 out of 5 stars Intro to the functional style and fun algorithmic content
If you are beginning to learn functional programming, this is a good book to study. It focuses much on the "no assignment" aspect of the functional style; a good place to start. Read more
Published on March 28, 2008 by Litsios James
3.0 out of 5 stars Interesting, but more academic than practical
This is the best book available on the implementation of data structures in functional programming languages (e.g. ML, Haskell). Read more
Published on June 11, 2000
Search Customer Reviews
Search these reviews only

More About the Author

Discover books, learn about writers, read author blogs, and more.

What Other Items Do Customers Buy After Viewing This Item?


Forums

There are no discussions about this product yet.
Be the first to discuss this product with the community.
Start a new discussion
Topic:
First post:
Prompts for sign-in
 


Look for Similar Items by Category