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: Evaluation of Conditional Definitions(2)

  • To: mathgroup at smc.vnet.net
  • Subject: [mg33819] Re: Evaluation of Conditional Definitions(2)
  • From: "Allan Hayes" <hay at haystack.demon.co.uk>
  • Date: Fri, 19 Apr 2002 02:27:38 -0400 (EDT)
  • References: <NDBBJGNHKLMPLILOIPPOCELOCOAA.djmp@earthlink.net>
  • Sender: owner-wri-mathgroup at wolfram.com

David,
Here is another way, one that lets us use either Set or SetDelayed.
The statement, from the Help Browser,

- Using Update will never give you incorrect results, although it will slow
down the operation of the system.

though technically correct, looks in need of a little more explanation,
since the result is changed.


    Clear[g,a,UseDefinition];
    g[a]/;UseDefinition==rue:=2
    expr/;(Update[g];True)=g[a];   (*uses Set*)

    UseDefinition=False;
    expr

        g[a]

    UseDefinition=True;
    expr

        2

    UseDefinition=False;
    expr

        g[a]

    UseDefinition=True;
    expr

        2

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: Help with 3D Graphics
  • Next by Date: Placing parameters in memory
  • Previous by thread: RE: Help with 3D graphics
  • Next by thread: RE: Re: Evaluation of Conditional Definitions(2)