2.10 User extension
define-loop-method. The following syntax is used for inclusivity:
as} var [type-spec]
When you define a loop method with
define-loop-method and use this syntax to invoke it, the loop method function's inclusive? flag is set to
t. See the reference page for
define-loop-macro for more information about the inclusive? flag.
Inclusivity allows you to specify that, in the first iteration, the var argument should be set to the value of the expression argument.
In the following example, the loop method
descendants iterates through all of a specified window's children in a hierarchical window system, and the function
shine is applied to every descendant window of the root window.
Without inclusivity, the loop iterates over the window's children only:
(loop for w being the descendants of (root-viewport) do (shine w))With inclusivity, the user of the loop method can access the window itself during the first iteration.
(loop for w being (root-viewport) and its descendants do (shine w))
Generated with Harlequin WebMaker