Skip to content

design question

2 messages · Bill Venables, Peter Dalgaard

#
Erich Neuwirth asks:
The Maple notation is more understandable to most people:

	map(x -> x^2, {1, 2, 3})

but of course "->" is already taken in S/R as the right pointing
assignment operator (although maybe I'm the only one who even knows
about it, let alone uses it...)
Either swiped from TeX or both have swiped the idea from a common
source.  It has the look of a macro language, which can be misleading.
Cryptic for most users, I'd say, and very macro-like.
It has to have very low priority, possibly negative.  If syntactic
revisions were ever seriously contemplated, I would strongly favour
trying to bring in some of the S4 changes, but even there I would
regard the semantic extensions as much more urgent than the purely
syntactic ones.  Consistency with S-PLUS is not the final arbiter of
everthing but it does really matter.
#
Bill Venables <venables@acland.qld.cmis.csiro.au> writes:
We do have a couple of cases where we allow expressions instead of
functions of one variable, with "x" marking the spot of the
indep.var., e.g. curve(exp(x)) works that way.

In principle we could allow a similar convention for functions of two
variables, e.g. outer(u, v, x^2 + y^2). There are various nasty
pitfalls in the kind of code needed to support this, though: For
instance, writing a function that passes its argument on to curve()
needs to do it with substitute() magic and evaluation in parent
frames. Also take a look at the beginning of curve() for the
contorsions the code needs to go through to handle the non-function
cases. On the whole, I'm not sure this kind of apparent
user-convenience is worth it.

BTW, we also have positional TeX-style arguments, but fortunately
nobody knows about them:
[1] 13