Re: Slots & Ampersands
- To: mathgroup at smc.vnet.net
- Subject: [mg74388] Re: Slots & Ampersands
- From: Peter Pein <petsie at dordos.net>
- Date: Mon, 19 Mar 2007 22:03:02 -0500 (EST)
- References: <etlq8s$rab$1@smc.vnet.net>
Mr Ajit Sen schrieb:
> Dear MathGroup,
>
> I've always regarded the Slot and Ampersand as being
> inseparable in Mathematica (the Laurel & Hardy of
> Mathematica?), and was surprised to find one of them absent
> in
>
> Plot[Sin[x], {x, 0, 2Pi}, ColorOutput ->
> (RGBColor[1, 0, 0]&)]
>
> [Help Browser under ColorOutput::colpc ,Examples]
>
> Question 1
>
> Where is Laurel gone? Is he inside ColorOutput or
> RGBColor?
>
> Question 2
>
> Are there other similar constructs in Mathematica? [No # ]
>
> Thanks for your help.
>
> Ajit Sen.
>
Hello,
there is no need for a '#' in a constant-valued function:
In[1]:= f = myConstantFunctionValue & ;
In[2]:= f[foo]
Out[2]= myConstantFunctionValue
In[3]:= f'[bar]
Out[3]= 0
(Hardy is quite boring without Laurel, isn't he?)
Peter