Mathematica 9 is now available
Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2002
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*November
*December
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

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: [mg37408] Re: how to avoid this evaluation?
  • From: arrayan137 at yahoo.com (elcofres)
  • Date: Sat, 26 Oct 2002 02:04:44 -0400 (EDT)
  • References: <ap5g9b$4l1$1@smc.vnet.net> <ap85i8$50p$1@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

I tried with

SetAttributes[MyFunction, HoldRest]

and

SetAttributes[MyFunction, HoldAll]

but the problem is that the main loop replaces the symbol 'a' with its
value. For example for

a = x^2;

f[x_] := Print[x];

SetAttributes[f, HoldAll];

f[a]

gives

x^2

I'd like to get something like

a = x^2

or just the symbol "a". I looked at the attributes of Definition  and
FullDefinition, but they have just HoldAll and Protected. Maybe they
are special in some sense, and the main loop knows not to replace the
argument with its value.

Elcofres

"Allan Hayes" <hay at haystack.demon.co.uk> wrote in message news:<ap85i8$50p$1 at smc.vnet.net>...
> > 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
>


  • Prev by Date: Re: HelpBrowser Mathematica Book 1.8.3 on Linux
  • Next by Date: Re: HelpBrowser Mathematica Book 1.8.3 on Linux
  • Previous by thread: Re: how to avoid this evaluation?
  • Next by thread: Bad parentheses in exported eps