Next: , Previous: , Up: API Reference   [Contents][Index]


3.8 Iterations

Grip module that provides a few more iteration mechanisms, which you may load using:

(use-modules (grip iter))

Syntax

dolist
dotimes

Syntax

Syntax: dolist (variable list [result]) body …

Returns result if it is passed, otherwise nothing.

Successfully binds variable to each element of list and executes body

(dolist (item '(a b d c) 4) (display item))
-| abcd
4
Syntax: dotimes (variable count [result]) body …

Returns result if it is passed, otherwise nothing.

Executes bodycount times, with variable successfully binded to each integer in the range [0 (- count 1)].

(dotimes (i 4) (display i))
-| 0123