Purely Functional Data Structures. Chris Okasaki. September CMU-CS School of Computer Science. Carnegie Mellon University. Pittsburgh, PA. PURELY FUNCTIONAL DATA STRUCTURES. Most books on data structures assume an imperative language like C or C++. However, data structures for these . Purely Functional Data Structures – Okasaki (PDF) (medical-site.info) to Clojure or another more modern functional lang I could understand.

Author: | ERIK MCFADDEN |

Language: | English, Spanish, French |

Country: | Bolivia |

Genre: | Technology |

Pages: | 505 |

Published (Last): | 11.11.2015 |

ISBN: | 393-4-18657-164-6 |

Distribution: | Free* [*Register to download] |

Uploaded by: | TALIA |

Purely Functional Data Structures [Okasaki] on medical-site.info *FREE* shipping on qualifying offers. Most books on data structures assume an imperative. Various interesting articles, in PDF or PS form. Contribute to aistrate/Articles development by creating an account on GitHub. It's the world's first textbook on purely functional data structures — i.e., data structures with no side-effects. I'm not going to explain in this blog.

Okasaki's book of the same name, based on his thesis, is one of my favourites—I'd recommend it to all programmers, not just those doing a lot of functional programming. The explanations are lucid and insightful, and the book is full of helpful diagrams and example code. The sample code is in Standard ML, but there's an appendix with Haskell versions of all the main data structures discussed in the book. I should have made that clearer. By "based on" I meant that it builds on, clarifies and extends his thesis in my experience, books based on theses often fail to do this. From Okasaki's blog:

I seem to recall a similar library existing for F but I couldn't find a link, sorry. I first learned about this book from Yegge's blog back when he was still at site where he wrote: It's a foregone conclusion. And that, in a roundabout way, brings me to this book by Chris Okasaki. It is absolutely unique.

It's the world's first textbook on purely functional data structures — i. I'm not going to explain in this blog why this is such an important topic for site and distributed computing in general, but I will point you to the book in the hopes that you are also interested in finding a solution.

Note, this isn't the book , it's his thesis. The book which is great expands upon it. For example, a data structure using an array and destructive updates may be replaced by a similar data structure where the array is replaced by a map , a random access list, or a balanced tree , which admits a purely functional implementation.

But the access cost may increase from constant time to logarithmic time.

A data structure is never inherently functional. For example, a stack can be implemented as a singly-linked list.

This implementation is purely functional as long as the only operations on the stack return a new stack without altering the old stack. However, if the language is not purely functional, the run-time system may be unable to guarantee immutability.

This is illustrated by Okasaki [1]: In order to ensure that a data structure is used in a purely functional way in an impure functional language, modules or classes can be used to ensure manipulation via authorized functions only. In his book Purely Functional Data Structures , computer scientist Chris Okasaki describes techniques used to design and implement purely functional data structures, a small subset of which are summarized below.

Lazy evaluation is particularly interesting in a purely functional language [1]: Therefore, lazy evaluation naturally becomes an important part of the construction of purely functional data structures.

It allows computations to be done only when its result is actually required.

Therefore, the code of a purely functional data structure can, without loss of efficiency, consider similarly data that will effectively be used and data that will be ignored. The only computation required is for the first kind of data that will actually be performed. One of the key tools in building efficient, purely functional data structures is memoization [1]: When a computation is done, it is saved and does not have to be performed a second time.

This is particularly important in lazy implementations; additional evaluations may require the same result, but it is impossible to know which evaluation will require it first. Some data structures, even those that are not purely functional such as dynamic arrays , admit operation that are efficient most of the time i.

Amortization can then be used to prove that the average running time of the operations are efficient [1]: That is to say, the few inefficient operations are rare enough, and do not change the asymptotical evolution of time complexity when a sequence of operations is considered. In general, having inefficient operations is not acceptable for persistent data structures, because this very operation can be called many times.

It is not acceptable either for real-time or for imperative systems, where the user may require the time taken by the operation to be predictable.

Furthermore, this unpredictability complicates the use of parallelism [1]: In order to avoid those problems, some data structures allow for the inefficient operation to be postponed—this is called scheduling [1]: IT Research Library.

Miscellaneous Books. Computer Languages. Computer Science.

Electronic Engineering. Linux and Unix. Microsoft and. Mobile Computing.