Macro Def-Gmap-Res-Type

Part of:

package gmap
( def-gmap-res-type name args &body body )
Defines a GMap result-type. Syntax is identical to defun. The body should
return a list of 2 to 5 elements: (0, “init”) the initial value of the state
variable; (1, “resfn”) a function of two arguments which is called on the
state variable and the current value of the function being mapped, returning
the new value of the state variable; (2, “cleanup”), if non-nil, a function
of one argument which is called on the final value of the state variable to
get the value of the gmap form; (3, “filterp”), if non-nil, a predicate
of one argument which is called on the current value of the function being
mapped, a false value causing “resfn” not to be called on this iteration (and
the state variable to be unchanged); and (4, “let-specs”) a list of
clauses for an nlet that will wrapped around the entire expansion.

It is also possible for a result-type to consume more than one value of the
function being mapped. If element 1, “resfn”, is of the form (:consume N
FN)
, FN should be a function of N + 1 arguments, and will receive N values
from the function being mapped.