MathGroup Archive 1997

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

Search the Archive

Call By Reference

  • To: mathgroup at smc.vnet.net
  • Subject: [mg6774] Call By Reference
  • From: Adalbert Hanssen <hsse at amath01.amath.zeiss.de>
  • Date: Fri, 18 Apr 1997 02:37:41 -0400 (EDT)
  • Sender: owner-wri-mathgroup at wolfram.com

Dear Ebersloh,

your problem can easily be solved using Hold, HoldFirst etc.
Define your function fun as usually, then e.g. SetAtributes[fun, HoldFirst],
and the invoke fun. Of course, then you must supply a symbol for held
parameters. The following does *NOT* work for a function unsing Hold or any of
its flavours (as the counterpart also does not for call-by-reference parameters
in other programming languages):

f[x_]:=...
SetAttributes[f,HoldFirst];
f[1]		(* this does not work, only supply *symbols*  *)
x=1;
f[x]		(* this works *)

best regards

Dipl-Math. Adalbert Hanszen <hsse at amath01.amath.zeiss.de>


  • Prev by Date: Including Functions and Variables from another Notebook
  • Next by Date: Downloadable Screen backgrounds Available
  • Previous by thread: Re: Including Functions and Variables from another Notebook
  • Next by thread: Downloadable Screen backgrounds Available