MathGroup Archive 1999

[Date Index] [Thread Index] [Author Index]

Search the Archive

MyPrependTo

  • To: mathgroup at smc.vnet.net
  • Subject: [mg15921] MyPrependTo
  • From: wself at viking.emcmt.edu (Will Self)
  • Date: Wed, 17 Feb 1999 23:33:55 -0500
  • Sender: owner-wri-mathgroup at wolfram.com

In trying to create my own version of PrependTo, I ran into some strange
stuff that I don't understand.  I am calling my function "push".  Please
look at the session below and explain these mysterious happenings.
It seems clear that there is more than one symbol e kicking around,
but I can't make head or tail of it.  See also my next message for
the larger context.


In[2]:=
push[someStack_, elt_] := (someStack = Prepend[someStack, elt];)

In[3]:=
e=stack["expression"]
Out[3]=
stack["expression"]

In[4]:=
push[e,1]

In[5]:=
e
Out[5]=
stack[1,"expression"]

In[6]:=
push[e,2]

In[7]:=
e

Out[7]=
stack[2,1,"expression"]

In[8]:=
Rest[e]
Out[8]=
stack[2,1,"expression"]    (* WHAT!!!!???? *)

In[9]:=
?e
"Global`e"
e = stack["expression"]   (* DOUBLE WHAT!!!!???? *)


Will Self


  • Prev by Date: Re: Re: Bug?
  • Next by Date: log log plot
  • Previous by thread: Position Available
  • Next by thread: Re: MyPrependTo