Displaying 2 results from an estimated 2 matches for "mystack".
Did you mean:
mstack
2003 Feb 25
2
push/pop on a stack
Is there a package for stacks with pushing and popping?
I'd really like to do something like
push(par(no.readonly=TRUE))
some stuff....
par(pop())
It seems like it wouldn't be difficult, and that someone may have already
implemented a set of stack functions, and I wouldn't like to duplicate it.
Thanks for your time,
Dave
--
Dave Forrest (434)924-3954w(111B) (804)642-0662h
2000 Apr 20
1
stack operations on vectors
It would be nie to have some basic stack operations for simple vectors and
lists. ie:
> a <- c(1,2,3,4,5)
> b <- pop(a)
> a
[1] 1 2 3 4
>b
[1] 5
> push(b, 6)
> b
[1] 5 6
notice how pop and push modify the original vector and not local copy
inside the functions environment. Is there any way to do this? I tried
this:
push <- function(vec,val) {
vec <<-