On Sat, Oct 26, 2013 at 4:32 AM, Donald Arseneau <[log in to unmask]> wrote:
>> But the functional programming concept doesn't really fit the expl3
>> concept, except for token lists.
> I'm not sure if the expl3 "map" is a straight "foreach" or a
> list accumulator. There are several "*map*" definitions in
> expl3 internals. The one you mean, Does it convert a list of
> x,y,z to a list of f(x),f(y),f(z)? If so, it is a proper
> mapping operation. Or does it just spit out f(x), f(y), and
> f(z) in turn? Then it should just be "foreach".
Exactly. The expl3 map functions visit each element of a
data-structure in turn, apply the provided function, then leave the
result in the input stream. That's why I was thinking 'foreach' would
have been a better name. And indeed, the provided function doesn't
have to be pure or side-effect free. An expl3 mapping function is
really a looping construct.