Re: Equating a variable and its value

• To: mathgroup at christensen.cybernetics.net
• To: mathgroup at christensen.cybernetics.net
• Subject: [mg1228] Re: Equating a variable and its value
• From: jorma.virtamo at vtt.fi (Jorma Virtamo)
• Date: Fri, 26 May 1995 03:29:57 -0400

```jans at matematik.su.se (Jan Snellman) wrote:
>
>
> Hello folks.
>
> Study this codelet:
>
> m=3; mult=Times[#,m]&; Clear[m]; mult[10]
>
> To my dismay, I get 10 m, not 30.
> How can i convince Mathematica that only pedants make the distinction
> between a variable and its value?
>
> Regards,
> Jan Snellman	jans at matematik.su.se
>

In the constuction Times[#,m]& parameter m is not evaluated until
the time of application of the function because of the non-standard
evaluation rule of "Function" (see the Book, p. 279).

One possibility to overcome the problem is to write

mult = Function[x,x #]& [m]

Now m gets evaluated at the time of definition by the standard
evaluation procedure.

-- Jorma Virtamo

============================================================
Jorma Virtamo
VTT Information Technology / Telecommunications
P.O. Box 1202,  FIN-02044 VTT,  Finland
phone: +358 0 456 5612          fax: +358 0 455 0115
email: jorma.virtamo at vtt.fi     web: http://www.vtt.fi/tte/
============================================================

```

• Prev by Date: Re: Why can't I solve this SIMPLE problem?
• Next by Date: INTERACTIVE USE OF MATHEMATICA
• Previous by thread: Re: Why can't I solve this SIMPLE problem?
• Next by thread: Re: Equating a variable and its value