LATEX-L Archives

Mailing list for the LaTeX3 project


Options: Use Classic View

Use Monospaced Font
Show Text Part by Default
Show All Mail Headers

Topic: [<< First] [< Prev] [Next >] [Last >>]

Print Reply
Donald Arseneau <[log in to unmask]>
Fri, 25 Oct 2013 19:32:48 -0700
text/plain (41 lines)
On Fri, October 25, 2013 3:36 pm, Michiel Helvensteijn wrote:
> On Sat, Oct 26, 2013 at 12:28 AM, Michiel Helvensteijn
> <[log in to unmask]> wrote:
>>> "map" ("mapping") is the usual term.
>> I think "map" is taken. Though it beats me why "map" isn't actually
>> called "foreach", or somesuch. :-)
> Correction, I'm pretty sure I know why the name was chosen:
> 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".

Even in the case of the list accumulator, the function result
has to be fully determined by the input argument item for it
to be a true map.  Functional programmers don't list this
requirement because it is the basic assumption underlying
functional programming. Conversely, TeX has no good way to
enforce that rule should the user want to accumulate sums or
similar. I wouldn't worry too much about that, but it could
make the "map" name confusing in some circumstances.

The character-token mapping implemented by misusing \uppercase
or \lowercase should probably be called charmap (or map_char).
I can't say if one or more of the other mapping macros should be
renamed "foreach".  Even if it is a real map, the name "mapeach"
will help reduce confusion.

Donald Arseneau, TRIUMF CMMS, [log in to unmask]