[Rd] design question

Erich Neuwirth erich.neuwirth@univie.ac.at
Sun, 18 Jun 2000 08:53:07 +0200


let me ask you as possibly very silly question.

what  would you think of a shorthand notation for anonymous fuctions in
arguments?

let me illustrate this in how mathematica does it.

mathematica has a function notation like R

Map[Function[x, x^2], {1, 2, 3}]

this can be abbreviated as
Map[#^2 &, {1, 2, 3}]

& indicates a function expression,
and # is the (one) anonymous argument.
functions with more that one arguments
(whch are positional) can be written as
#1  #2
and so on

here is an example
Outer[#1^2 + #2^2 &, {1, 2}, {3, 4}]

in some cases, this notation is quite convenient.
and since r is lexically scoped, it also should not be too dangerous.
what do our architects think about introducing this kind of notation
in r?



--
Erich Neuwirth, Computer Supported Didactics Working Group
Visit our SunSITE at http://sunsite.univie.ac.at
Phone: +43-1-4277-38624 Fax: +43-1-4277-9386
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-devel mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-devel-request@stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._