MathGroup Archive 1999

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

Search the Archive

Re: MyPrependTo


> 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
Return[]

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 irisa.fr           http://www.irisa.fr/caps/PEOPLE/Dan
gsm:06 14 78 06 95 -> http://www.sfr.fr/html/annexes/sms/sendsms.html


  • 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