Re: Slots & Ampersands
- To: mathgroup at smc.vnet.net
- Subject: [mg74377] Re: Slots & Ampersands
- From: Jean-Marc Gulliet <jeanmarc.gulliet at gmail.com>
- Date: Mon, 19 Mar 2007 21:56:58 -0500 (EST)
- Organization: The Open University, Milton Keynes, UK
- References: <etlq8s$rab$1@smc.vnet.net>
Mr Ajit Sen wrote:
> 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
Only # or ## can be drooped (constant functions that do not depend on
the values of some parameters).
The symbol & marks the end of the definition of the pure function.
> 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?
No need: this is a constant function that always returns red.
> Question 2
>
> Are there other similar constructs in Mathematica? [No # ]
Yes.
The thread called "& without #" is worth reading. See
http://forums.wolfram.com/mathgroup/archive/2007/Jan/msg00605.html
Regards,
Jean-Marc