Functional hierarchical zipper, with navigation, editing, and enumeration. See Huet
Project description
Zipper [![Build Status](https://travis-ci.org/trivio/zipper.png)](https://travis-ci.org/trivio/zipper)
======
A datastructure, first described by Huet, is used to traverse and
manipulate immutable trees. This library is a port of the zipper
implementation found in Clojure.
Usage
-----
The zipper module provides several functions for creating a Loc object which
represents the current focal point in the tree.
```
>>> import zipper
>>> top = zipper.list([1, [2, 3], 4])
>>> print top.down().right().node()
[2,3]
>>> print top.down().right().down().node()
2
>>> print top.down().right().down().replace(0).root()
[1, [0, 3], 4]
```
======
A datastructure, first described by Huet, is used to traverse and
manipulate immutable trees. This library is a port of the zipper
implementation found in Clojure.
Usage
-----
The zipper module provides several functions for creating a Loc object which
represents the current focal point in the tree.
```
>>> import zipper
>>> top = zipper.list([1, [2, 3], 4])
>>> print top.down().right().node()
[2,3]
>>> print top.down().right().down().node()
2
>>> print top.down().right().down().replace(0).root()
[1, [0, 3], 4]
```
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
zipper-0.0.1.tar.gz
(3.4 kB
view details)
File details
Details for the file zipper-0.0.1.tar.gz
.
File metadata
- Download URL: zipper-0.0.1.tar.gz
- Upload date:
- Size: 3.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6f94a54bf05fd24563acbec1fa06202010de697a1304a33b89f8d7e3001ffa11 |
|
MD5 | 4434cb9835d86ea596f609c23c119858 |
|
BLAKE2b-256 | 790364358aaeae6caca90d0e17d434563f59ab12d19aa7fed293e94c54726c62 |