Side effects
Functions iterating over lists for side effect only.
Function: -each (list fn)
Call fn on each element of list. Return nil; this function is intended for side effects.
Its anaphoric counterpart is --each.
For access to the current element’s index in list, see -each-indexed (see -each-indexed).
(-each '(1 2 3) #'identity)
⇒ nilFunction: -each-while (list pred fn)
Call fn on each item in list, while (pred item) is non-nil. Once an item is reached for which pred returns nil, fn is no longer called. Return nil; this function is intended for side effects.
Its anaphoric counterpart is --each-while.
Function: -each-indexed (list fn)
Call fn on each index and element of list. For each item at index in list, call (funcall fn index item). Return nil; this function is intended for side effects.
See also: -map-indexed (see -map-indexed).
(let (l) (-each-indexed '(a b c) (lambda (i x) (push (list x i) l))) l)
⇒ ((c 2) (b 1) (a 0))Function: -each-r (list fn)
Call fn on each element of list in reversed order. Return nil; this function is intended for side effects.
Its anaphoric counterpart is --each-r.
(-each-r '(1 2 3) #'identity)
⇒ nilFunction: -each-r-while (list pred fn)
Call fn on each item in reversed list, while (pred item) is non-nil. Once an item is reached for which pred returns nil, fn is no longer called. Return nil; this function is intended for side effects.
Its anaphoric counterpart is --each-r-while.
Function: -dotimes (num fn)
Call fn num times, presumably for side effects. fn is called with a single argument on successive integers running from 0, inclusive, to num, exclusive. fn is not called if num is less than 1.
This function’s anaphoric counterpart is --dotimes.