chickadee » srfi-197 » nest-reverse

(nest-reverse <initial-value> [<placeholder>] <step> ...)procedure

nest-reverse is variant of nest that nests in reverse order, which is the same order as chain.

<initial-value> is an expression. <placeholder> is a literal symbol; this is the placeholder symbol. If <placeholder> is not present, the placeholder symbol is _.

The syntax of <step> is (<datum> ... <_> <datum> ...), where <_> is the placeholder symbol.

(nest-reverse e (c d _) (a b _)) ; => (a b (c d e))

A nest-reverse expression is evaluated by lexically replacing the <_> in the first <step> with <initial-value>, then replacing the <_> in the second <step> with that replacement, and so on until the <_> in the last <step> has been replaced. It is an error if the resulting final replacement is not an expression, which is then evaluated and its values are returned.