Skip to content

.Last.value or % or ANS or ... (was unix)

5 messages · Mark Myatt, Charles C. Berry, Peter Dalgaard +1 more

#
ben@zoo.ufl.edu writes:
That is an interesting idea. I have yet to use anything like a stack in
R but I guess that it should be easy enough to do (it might even be
there already). Seems to me that something like the way Forth works ...
with a stack and reverse polish notation might suit you.

Mark


--
Mark Myatt


-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
#
ESS comes fairly close to providing this capability:

M-p  plays comint-previous-input

C-u number M-p plays goes back thru 'number' inputs

comint-previous-input clobbers the existing command line, so to get
you would need to type

abc( RET C-u k M-p )

or 

abc( RET M-p ... M-p )

hitting M-p k times

Admittedly, this is NOT the same as having a stack of objects...

Chuck Berry
On Mon, 20 Nov 2000 ben@zoo.ufl.edu wrote:

            
Charles C. Berry                        (858) 534-2098 
                                         Dept of Family/Preventive Medicine
E mailto:cberry@tajo.ucsd.edu	         UC San Diego
http://hacuna.ucsd.edu/members/ccb.html  La Jolla, San Diego 92093-0645

 

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
#
"Charles C. Berry" <cberry@tajo.ucsd.edu> writes:
It would be no big deal to create a stack of objects resulting from
the last N expressions. What I'm not too sure about is whether you'd
really want that. Notice that it could imply keeping several copies of
a data set in memory. E.g. the value of an assignment like "data <-
transform(data, logx=log(x))" is the value of the RHS.
#
I see that this simple solution has troubles.
  I think part of the way Mathematica deals with is by doing slick things
with storage, not storing multiple copies of identical objects.  I
understand that .Alias is scary, but would there be any way of using the
same mechanism to keep a buffer/stack/list/whatever of links to previous
answers?
On 8 Nov 2000, Peter Dalgaard BSA wrote:

            

  
    
11 days later
#
That's true, but I was looking for a more comprehensive solution (which
would be harder to implement, and have the potential to gobble memory like
crazy) of being able to retrieve an list of past values -- "oh, that
third-to-last answer is the one I needed, I'll take that and put it in
this expression"
  (Besides which, 4 characters are better than 11 but worse than 1 or 2)

  I've moved this to R-devel.
On Tue, 7 Nov 2000, Mark Myatt wrote: