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).
The code is at the stage of adding final features before the first version testing and release.
(You can find more examples in the test/i-test.el)
Prints "Hello, world!" 100 times
(++ (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
(++ (for (a b) in '((1 2) (3 4))) (message "a: %s, b: %s" a b))
Iterates over an array and prints its elements
(++ (for i across [1 2 3 4]) (message "i: %d" i))
You can read the documentation here: Iterate
$ cd ~/.emacs.d/i-iterate $ make
$ make test
Add the following lines to your init file (usually it is ~/.emacs, you may need to create one).(add-to-list 'load-path (expand-file-name "~/.emacs.d/i-iterate/lisp/")) (require 'i-iterate)