MathGroup Archive 2001

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

Search the Archive

tricky question

  • To: mathgroup at smc.vnet.net
  • Subject: [mg27960] tricky question
  • From: Otto Linsuain <linsuain+ at andrew.cmu.edu>
  • Date: Mon, 26 Mar 2001 05:27:08 -0500 (EST)
  • Sender: owner-wri-mathgroup at wolfram.com

Dear mathgroup:

this question has been teasing my brain for a while. It is about the
apparent IMPOSSIBILITY of defining certain functions as pure functions.

first take a simple case where it is POSSIBLE to define a pure function:

g[x_,y_]:= Times[x,y]   will do the same as      g := Times[ #1, #2 ] &

now in this case it seems to me it is IMPOSSIBLE to define a pure function:

g[x_,y_] :=  Map[ Times[ x, # ]&, y ]

is NOT the same as g :=  Map[ Times[ #1, #]& , #2]&  

the reason these two are not the same is that in the function on the top
line the arguments of Times would be x and the parts of y at level 1
taken in sequence, while in the function on the botton line, the
arguments of Times would both be just x, since #1 and # stand for the
same.

So, the question is: can  g[x_,y_] :=  Map[ Times[ x, # ]&, y ] be input
as a pure function?

Thanks in advance. Otto Linsuain.


  • Prev by Date: setdelayed function
  • Next by Date: Puzzled over (un)changing argument symbols in functions
  • Previous by thread: Re: setdelayed function
  • Next by thread: Re: tricky question