ELPA Logo NonGNU-devel ELPA: treepy

treepy Atom Feed

Description
Generic tree traversal tools
Latest
treepy.tar (.sig), 2026-May-31, 70.0 KiB
Maintainer
Other versions:
release version
Website
https://github.com/volrath/treepy.el
ELPA's Repository
CGit or Gitweb
Badge

To install this package from Emacs, use package-install or list-packages.

Full description

treepy.el (ˈtriːpi)

MELPA Emacs Build Status

A set of generic functions for traversing tree-like data structures recursively and/or iteratively, ported from clojure.walk and clojure.zip respectively.

Table of Contents

Getting Started

treepy supports Emacs 25.1+.

It is available in MELPA, which is the recommended way to install it and keep it up to date.

To install it, you may do

M-x package-install RET treepy RET

If the installation doesn't work, consider refreshing the package list: M-x package-refresh-contents [RET]

For a manual installation, just place treepy.el in your load-path and (require 'treepy). Then you'll have all the treepy-* functions available.

Available functions

Walker
Zipper
Construction
Context / Path
Navigation
Modification
Enumeration

Main differences with clojure libraries

Even though one of treepy's goals is to provide an API that's as close as possible to clojure.walk and clojure.zip, there are some subtle (and not so subtle) differences derived from elisp/clojure distinct data structures, levels of abstraction, and code conventions.

The most notorious difference is the name of the functions. For every function in Clojure world, there's a treepy counterpart that's prefixed with treepy-. So:

... and so on.

clojure.walk
clojure.zip
(treepy-next loc)  ;; => next node in preorder, as in clojure.zip/next.
(treepy-next loc :preorder)  ;; => also next node in preorder.
(treepy-next loc :postorder)  ;; => next node in postorder.

The following are some treepy's implementation differences that you might not need to bother with if you just wanna use the library.

((<current node> . <path alist>) . ((:branch-p . #'provided-branch-fn)
                                    (:children . #'provided-children-fn)
                                    (:make-node . #'provided-make-node-fn)))

Prior Art

LICENSE

© 2017 Daniel Barreto

Distributed under the terms of the GNU GENERAL PUBLIC LICENSE, version 3.

Old versions

treepy-0.1.3.0.20260531.3.tar.lz2026-May-3111.6 KiB
treepy-0.1.3.0.20260531.3.tar2026-May-3170.0 KiB
treepy-0.1.3.0.20260313.91605.tar.lz2026-Mar-1311.2 KiB
treepy-0.1.2.0.20240930.72831.tar.lz2026-Mar-1111.1 KiB