MathGroup Archive 2007

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

Search the Archive

Re: associate a parameter name with a string

  • To: mathgroup at smc.vnet.net
  • Subject: [mg75447] Re: associate a parameter name with a string
  • From: Januk <ggroup at sarj.ca>
  • Date: Tue, 1 May 2007 03:22:33 -0400 (EDT)
  • References: <f11ge6$kks$1@smc.vnet.net>

Hi Bill,

On Apr 29, 3:11 am, Bill Rowe <readnews... at sbcglobal.net> wrote:

<snip>
> I don't recall why it is necessary to use Set[#1,f[#2]]& instead
> of #1=f[#2]& in this application
<snip>

I think it is a matter of order of operations.  With the #1=f[#2]&
notation, where does the pure function start?  A typical use of the
shorthand may be:
myfunc = #1<#2&

Clearly in this case you want myfunc to be set to this pure function.
The same applies to #1=f[#2]&, you are trying to set the "symbol" #1
to f[#2]&.  This is not allowed.  To clear up the ambiguity, use
brackets:
(#1 = f[#2])&

Hope that helps.



  • Prev by Date: Logical comparisons of items in a two lists
  • Next by Date: Re: Loading packages from the internet?
  • Previous by thread: Re: Logical comparisons of items in a two lists
  • Next by thread: Re: Gauss-Kronrod algorithm