Skip to content

Latest commit

 

History

History
75 lines (45 loc) · 2.42 KB

README.md

File metadata and controls

75 lines (45 loc) · 2.42 KB

pair-tree.el

A cons cell explorer.

GPL v3 Melpa

M-x pair-tree is a learning tool for visualizing Emacs Lisp lists. It builds an explorable box‑and‑pointer diagram for cons cells.

If you're baffled by cons and confused by cdaadr you might want to give it a spin.

For example

M-x pair-tree '((2 . (turtle doves)) (3 french hens) 4 (calling . birds) partridge)

A visualization of the tree

Requirements

You will need Emacs 27.1 and svg support. Needless to say, this won't work on a terminal.

Installation

Via MELPA

  1. Use the MELPA package repository
(require 'package)
(add-to-list 'package-archives
             '("melpa" . "http://melpa.org/packages/") t)
  1. Refresh your packages

    M-x package-refresh-contents
    
  2. Install pair-tree

    M-x package-install pair-tree
    

Via GitHub

Clone this repository and add pair-tree.el to your load path:

(add-to-list load-path "/path/to/repo/pair-tree.el")

Usage

Call M-x pair-tree and type the list you want to visualise.

You can navigate the tree with the arrow keys. The minibuffer shows the most concise accessor for the focused section.

Other resources

If you're learning about lists, be sure to read the GNU Emacs manual. You may want to check out dash.el, the excellent list library used in this package.

Racket is an excellent programming language to learn in. If you're using it, take a look at the Sdraw cons cell visualizer instead.

If you're keen to dive deeply into box‑and‑pointer diagrams, have a read through Structure and Interpretation of Computer Programs by Ableson and Sussman.

Contributors

Thanks to the following people for helping pair-tree grow.