> Every page of the ganymede website is listed in https://eugo.io/docs/ganymede/llms.txt.

# RpdsPy

> RpdsPy: Python bindings to the Rust rpds crate for persistent data structures. A Python demo notebook from ganymede.

Web page: https://eugo.io/docs/ganymede/demo_notebooks/data_structures/rpdspy/
Notebook: https://eugo.io/docs/ganymede/demo_notebooks/data_structures/rpdspy/rpdspy.ipynb (source: https://github.com/eugo-inc/ganymede/blob/main/demo_notebooks/data_structures/rpdspy.ipynb)

Description:
- Python bindings to the Rust rpds crate for persistent data structures.

Resources:
- [GitHub] https://github.com/crate-py/rpds
- [Rust Crate Docs] https://docs.rs/rpds/latest/rpds/

## Example 1

Create a hash trie map

```python
from rpds import HashTrieMap

m = HashTrieMap({"foo": "bar", "baz": "quux"})
m.insert("spam", 37) == HashTrieMap({"foo": "bar", "baz": "quux", "spam": 37})
m.remove("foo") == HashTrieMap({"baz": "quux"})
```

## Example 2

Create a hash trie set

```python
from rpds import HashTrieSet

s = HashTrieSet({"foo", "bar", "baz", "quux"})
s.insert("spam") == HashTrieSet({"foo", "bar", "baz", "quux", "spam"})
s.remove("foo") == HashTrieSet({"bar", "baz", "quux"})
```

## Example 3

Create a list

```python
from rpds import List

L = List([1, 3, 5])
L.push_front(-1) == List([-1, 1, 3, 5])
L.rest == List([3, 5])
```
