# Does (guile) scheme have persistent data structures?

**URL:** <https://forum.systemcrafters.net/t/does-guile-scheme-have-persistent-data-structures/943>\
**Category:** Scheme\
**Tags:** guile\
**Created:** [August 25, 2024, 11:29am UTC](https://forum.systemcrafters.net/t/does-guile-scheme-have-persistent-data-structures/943 "2024-08-25T11:29:12Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![amano](https://avatars.discourse-cdn.com/v4/letter/a/ee59a6/32.png) [@amano](https://forum.systemcrafters.net/u/amano)\
**Post date:** [August 25, 2024, 11:29am UTC](https://forum.systemcrafters.net/t/does-guile-scheme-have-persistent-data-structures/943/1 "2024-08-25T11:29:12Z")

</div>

I miss persistent data structure from clojure.

---

<div class="post-metadata">

**Author:** ![amano](https://avatars.discourse-cdn.com/v4/letter/a/ee59a6/32.png) [@amano](https://forum.systemcrafters.net/u/amano)\
**Post date:** [August 27, 2024, 10:57am UTC](https://forum.systemcrafters.net/t/does-guile-scheme-have-persistent-data-structures/943/2 "2024-08-27T10:57:27Z")

</div>

I learned that there is no persistent data structure in guile scheme, yet.

Gauche scheme has persistent data structures described by R7RS large, but it doesn’t seem to integrate well with third party packages.

I also have to use guile scheme if I want to use gnu guix.

The langauge choice is driven by tools and ecosystems. The best language in the world without a use case is useless.

---

<div class="post-metadata">

**Author:** ![dthompson](https://yyz1.discourse-cdn.com/flex029/user_avatar/forum.systemcrafters.net/dthompson/32/133_2.png) [@dthompson](https://forum.systemcrafters.net/u/dthompson)\
**Post date:** [August 27, 2024, 1:49pm UTC](https://forum.systemcrafters.net/t/does-guile-scheme-have-persistent-data-structures/943/3 "2024-08-27T13:49:10Z")

</div>

Andy Wingo implemented persistent vectors and hashes years ago, but they are unfortunately just sitting on his server and not in any released library or in Guile itself:

[https://wingolog.org/pub/fector.scm](https://wingolog.org/pub/fector.scm)

[https://wingolog.org/pub/fash.scm](https://wingolog.org/pub/fash.scm)

These are the best implementations I’m aware of. I wish they weren’t so hard to discover! I have suggested to Andy that he should just push this stuff to Guile itself.

The best thing that’s available in Guile right now are vlists and vhashes in (ice-9 vlist) but they are not very good.

---

<div class="post-metadata">

**Author:** ![amano](https://avatars.discourse-cdn.com/v4/letter/a/ee59a6/32.png) [@amano](https://forum.systemcrafters.net/u/amano)\
**Post date:** [August 27, 2024, 2:24pm UTC](https://forum.systemcrafters.net/t/does-guile-scheme-have-persistent-data-structures/943/4 "2024-08-27T14:24:37Z")

</div>

R7RS large has mappings SRFI for persistent/mutable hash map.

R7RS large doesn’t seem to have persistent vector.

---

<div class="post-metadata">

**Author:** ![dthompson](https://yyz1.discourse-cdn.com/flex029/user_avatar/forum.systemcrafters.net/dthompson/32/133_2.png) [@dthompson](https://forum.systemcrafters.net/u/dthompson)\
**Post date:** [August 27, 2024, 2:53pm UTC](https://forum.systemcrafters.net/t/does-guile-scheme-have-persistent-data-structures/943/5 "2024-08-27T14:53:20Z")

</div>

R7RS large isn’t something you can actually use right now, certainly not in Guile anyway.

---

<div class="post-metadata">

**Author:** ![amano](https://avatars.discourse-cdn.com/v4/letter/a/ee59a6/32.png) [@amano](https://forum.systemcrafters.net/u/amano)\
**Post date:** [August 28, 2024, 1:41am UTC](https://forum.systemcrafters.net/t/does-guile-scheme-have-persistent-data-structures/943/6 "2024-08-28T01:41:42Z")

</div>

I don’t understand why R7RS large doesn’t focus on persistent data structures.

I used clojure, and persistent data structures made programming easy. It is the right way. Clojure also provided transient mutable data structures for constructing persistent data structures efficiently. Scheme should have persistent data structures and transient mutable data structures.

---

<div class="post-metadata">

**Author:** ![riley](https://avatars.discourse-cdn.com/v4/letter/r/2acd7d/32.png) [@riley](https://forum.systemcrafters.net/u/riley)\
**Post date:** [July 29, 2026, 9:42pm UTC](https://forum.systemcrafters.net/t/does-guile-scheme-have-persistent-data-structures/943/7 "2026-07-29T21:42:18Z")

</div>

The old-school way to do this is to use linked lists for sequential data and sets, and alists (association lists, list of key-value pairs) for hash-maps. These do not have the correct performance characteristics, but are functional, and, for small data, they are good enough.

You can wrap these in structs to provide a clojure-like interface in the meantime before you can get your hands on proper persistent data structures. Fortunately, there’s a lot of implementations of radix tries, relaxed radix tries, hash array mapped tries, and friends in both scheme and C and C++.
