Re: [R] how about a "<p-" operator?

From: Duncan Murdoch <>
Date: Thu, 31 Mar 2011 09:31:44 -0400

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


is slightly ambiguous: does it mean

x <- 3 # yes


x < -3 # no

I think the compound operator <p- would just repeat this problem. What does


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 mailing list PLEASE do read the posting guide and provide commented, minimal, self-contained, reproducible code. Received on Thu 31 Mar 2011 - 13:33:52 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Thu 31 Mar 2011 - 13:40:26 GMT.

Mailing list information is available at Please read the posting guide before posting to the list.

list of date sections of archive