i-iterate


A macro system for iterating in Emacs Lisp code

This library is inspired by the Common Lisp library with a similar name: http://common-lisp.net/project/iterate/ but it is not a direct translation. Some features were deliberately added, omitted or renamed.

This library attempts to provide macros to cover typical tasks that arise when programming in Emacs Lisp (eg. iterating over words in a buffer) as well as some task that belong in a general programming domain (eg. iterating over leafs of a tree in a breadth-first or depth-first order).

Status and readiness of the code

The code is at the stage of adding final features before the first version testing and release.

Some usage examples

(You can find more examples in the test/i-test.el)

Prints "Hello, world!" 100 times lisp (++ (repeat 100) (message "Hello, world!"))

Binds a and b to the first and second element of the list in the car of the cons cell of the list being iterated ```lisp

(++ (for (a b) in '((1 2) (3 4))) (message "a: %s, b: %s" a b))```

Iterates over an array and prints its elements lisp (++ (for i across [1 2 3 4]) (message "i: %d" i))

You can read the documentation here: Iterate

Installing

  1. Check out the repository

    ```sh

$ svn checkout http://i-iterate.googlecode.com/svn/trunk/ ~/.emacs.d/i-iterate ``` 1. Compile the project

```sh

$ cd ~/.emacs.d/i-iterate $ make ``` 1. Optionally, run the test

```sh

$ make test ``` 1. Install the project

Add the following lines to your init file (usually it is ~/.emacs, you may need to create one). ```lisp

(add-to-list 'load-path (expand-file-name "~/.emacs.d/i-iterate/lisp/")) (require 'i-iterate) ```

Project Information

The project was created on Nov 21, 2012.

Labels:
eLisp Emacs plugin