[R] how about a "<p-" operator?
Duncan Murdoch
murdoch.duncan at gmail.com
Thu Mar 31 15:31:44 CEST 2011
On 11-03-30 7:00 PM, Carl Witthoft wrote:
> I was cursing Matlab again today (what else is new) because the default
> action for every Matlab command is to spew the result to the console,
> and one must remember to put that darn ";" at the end of every line.
>
> So I just wondered: was there ever a discussion as to providing some
> modified version of the "<-" and "->" operators in R to do the reverse?
> That is, since R does not print the values of a command to the
> console, what if there were an operator such that
>
>
> newobject<p- somefunction()
>
> would do the same as
>
> print(newobject<- somefunction())
>
>
> Any thoughts?
Others have given alternatives. Just some comments on this particular
proposal:
We already have a problem that
x<-3
is slightly ambiguous: does it mean
x <- 3 # yes
or
x < -3 # no
I think the compound operator <p- would just repeat this problem. What does
x<p-3
mean? If the amount of typing in print(x <- 3) is a problem, that's a
user interface issue, so it should be addressed at the user interface
level, not by changing the language. A front-end could make it easy to
transform x <- 3 into the longer expression (or an equivalent), or just
make it easy to examine the .Last.value variable.
Duncan Murdoch
More information about the R-help
mailing list