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.
|Language:||English, Spanish, French|
|Distribution:||Free* [*Register to download]|
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.
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 : 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 : 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 : 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 : 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 : In order to avoid those problems, some data structures allow for the inefficient operation to be postponed—this is called scheduling : IT Research Library.
Miscellaneous Books. Computer Languages. Computer Science.
Electronic Engineering. Linux and Unix. Microsoft and. Mobile Computing.