MathGroup Archive 2002

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

Search the Archive

Re: how to avoid this evaluation?

  • To: mathgroup at smc.vnet.net
  • Subject: [mg37333] Re: how to avoid this evaluation?
  • From: "Allan Hayes" <hay at haystack.demon.co.uk>
  • Date: Thu, 24 Oct 2002 02:55:15 -0400 (EDT)
  • References: <ap5g9b$4l1$1@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

> MyFunction[a]
>
> and within MyFunction some variable gets assigned with a=x^2 (and not
> just with x^2). Is there a way of doing this? I don't like having to
> write MyFunction["a"]. In some way Save seems to know how to tell the
> system not to replace 'a' with its value.


Save has the attribute HoldRest, you can attach this to MyFunction with

    SetAttributes[MyFunction, HoldRest]

--
Allan

---------------------
Allan Hayes
Mathematica Training and Consulting
Leicester UK
www.haystack.demon.co.uk
hay at haystack.demon.co.uk
Voice: +44 (0)116 271 4198
Fax: +44 (0)870 164 0565


"elcofres" <arrayan137 at yahoo.com> wrote in message
news:ap5g9b$4l1$1 at smc.vnet.net...
> Hi,
>
> I'm trying to write a function similar to Save, but can't find how to
> stop the main loop from evaluating the argument. Let's say I have the
> definition
>
> a=x^2
>
> if I do
>
> Save[filename,a]
>
> the definition goes into the file, what I want is to get the
> definition into a variable inside my function, so I can do:
>
> MyFunction[a]
>
> and within MyFunction some variable gets assigned with a=x^2 (and not
> just with x^2). Is there a way of doing this? I don't like having to
> write MyFunction["a"]. In some way Save seems to know how to tell the
> system not to replace 'a' with its value.
>
> TIA
> Elcofres
>




  • Prev by Date: Re: how to avoid this evaluation?
  • Next by Date: Re: Bad parentheses in exported eps
  • Previous by thread: Re: how to avoid this evaluation?
  • Next by thread: Re: how to avoid this evaluation?