Purely Functional Data Structures

Table of Contents

1. Background

verified · pilot-annotation-pass · 2026-10-09

Implement persistent data structures with limited use of host data structures (other than function definition and simple data types).

This works off of Okasaki's "Purely Functional Data Structures" and Immutable.js.

2. Code

disputed · pilot-annotation-pass · 2026-10-09

3. Implementation

3.1. Pair

corrected · pilot-annotation-pass · 2026-10-09

3.2. Node

3.3. LinkedList

3.4. List

3.6. Map

3.7. Object

3.8. Set

3.9. Sequence

3.10. Collection

3.11. Stack

3.12. Record

3.13. Queue

3.15. Trie

3.20. Splay Heaps

4. Examples

5. API

corrected · pilot-annotation-pass · 2026-10-09

https://github.com/clojure/clojure/blob/master/src/clj/clojure/core.clj#L55

  • first
  • next
  • rest
  • second
  • ffirst
  • nfirst
  • fnext