Return[] in pure function
- To: mathgroup at smc.vnet.net
- Subject: [mg58870] Return[] in pure function
- From: dh <dh at metrohm.ch>
- Date: Thu, 21 Jul 2005 15:46:02 -0400 (EDT)
- Sender: owner-wri-mathgroup at wolfram.com
Hi, I seems to me that there is a bug in the implementation of pure functions. If somebody can explain the following behaviour it would be interessting. If not, maybe Wolfram can contribute something. Consider f[x_]:= If[x==0,Return[Error],x]; f /@ {1,0} gives {1,Error} what is fine. Now replace the function by a pure function: If[#==0,Return[Error],#]& /@ {1,0} this gives {1,Return["Error"]}. The Return statement has not been evaluated. sincerely, Daniel