MathGroup Archive 1999

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

Search the Archive

Re: MyPrependTo

  • To: mathgroup at
  • Subject: [mg15988] Re: MyPrependTo
  • From: Dan Truong <dtruong at>
  • Date: Fri, 19 Feb 1999 03:27:06 -0500
  • Organization: Irisa, Rennes (FR)
  • References: <7ag26u$>
  • Sender: owner-wri-mathgroup at

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

Is it legal in Mathematica to assign a function parameter?
I think not, because they are avaluated before going in the
function body (ie, parameters are passed by value, not by
reference or pointers)

The solution is to use a golbal stack parameter, or to use

Push[...] := ( Return[Prepend[...]]);
e = Push[e,1];

BTW: does anyone know how to pass a pointer to an object
so it can be modified and returned? HoldFirst etc. do not
do that.

Dan N. Truong,  IRISA, Campus de Beaulieu, 35042 Rennes Cedex, FRANCE
tel:(+33)2 99 84 25 39            fax:(+33)2 99 84 25 28
mailto:dtruong at 
gsm:06 14 78 06 95 ->

  • Prev by Date: Re: Figure legend & Overlapping text pb (LINKs)
  • Next by Date: Re: implementing a stack
  • Previous by thread: Re: MyPrependTo
  • Next by thread: Re: MyPrependTo