Mathematica 9 is now available
Services & Resources / Wolfram Forums / MathGroup Archive
-----

MathGroup Archive 2009

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

Search the Archive

Re: Re: pure function with optional number of arguments

  • To: mathgroup at smc.vnet.net
  • Subject: [mg99017] Re: [mg99003] Re: pure function with optional number of arguments
  • From: DrMajorBob <btreat1 at austin.rr.com>
  • Date: Fri, 24 Apr 2009 03:46:14 -0400 (EDT)
  • References: <200904220912.FAA13452@smc.vnet.net> <gsmrus$ger$1@smc.vnet.net>
  • Reply-to: drmajorbob at bigfoot.com

Fine. But where is the first form documented?

Bobby

On Thu, 23 Apr 2009 15:00:50 -0500, Leonid Shifrin <lshifr at gmail.com>  
wrote:

> Check this, for example:
>
> In[1] = Function[Null, Head[Unevaluated[#]], HoldFirst][Print[1]]
>
> Out[1] = Print
>
> In[2] = Function[Null, Head[Unevaluated[#]], HoldFirst] &[Print[1]]
>
> 1
>
> Out[2] = Function[Null, Head[Unevaluated[#1]], HoldFirst],
>
> v.6.0
>
> Regards,
> Leonid
>
> On Thu, Apr 23, 2009 at 9:53 AM, DrMajorBob <btreat1 at austin.rr.com>  
> wrote:
>
>> I don't see, in the documentation, anything like Function[Null,
>> body[##],Attributes] as a complete function -- that is, ##, #, or #n  
>> without
>> their inclusion in a pure function ending in &.
>>
>> Function[Null, body[##],Attributes]& perhaps, but not Function[Null,
>> body[##],Attributes] alone.
>>
>> Bobby
>>
>>
>> On Thu, 23 Apr 2009 05:46:37 -0500, Leonid Shifrin <lshifr at gmail.com>
>> wrote:
>>
>>  Yes indeed you are right, sorry for the confusion - just a stupid  
>> mistake.
>>> I had in mind an (irrelevant to this problem)  possibility to use
>>> Function[Null, body[##],Attributes] to give attributes to pure  
>>> functions
>>> defined with slots, which I believe is an undocumented feature (at  
>>> least,
>>> according to Roman Maeder as of v.4 - may be now it is, but I did not  
>>> see
>>> it).
>>>
>>>
>>> Regards,
>>> Leonid
>>>
>>> 2009/4/22 Szabolcs Horv=E1t <szhorvat at gmail.com>
>>>
>>>  Leonid Shifrin wrote:
>>>>
>>>>  Hi Ruth,
>>>>>
>>>>> You can use the undocumented form of the pure function which can take
>>>>> an=
>>>>>
>>>> y
>>>
>>>> number of arguments:
>>>>>
>>>>> Function[Null, body[##]].
>>>>>
>>>>>
>>>> This is a standard documented feature.  See these doc pages:
>>>>
>>>> http://reference.wolfram.com/mathematica/ref/Function.html#29126
>>>> http://reference.wolfram.com/mathematica/ref/SlotSequence.html
>>>>
>>>>
>>>
>>>
>>
>>
>> --
>> DrMajorBob at bigfoot.com
>>



-- 
DrMajorBob at bigfoot.com


  • Prev by Date: Paste image directly into V7 notebook on Linux/X11
  • Next by Date: Re: fitting surface with Mathematica 6.0.3 and range of fitted values
  • Previous by thread: Re: Re: pure function with optional number of arguments
  • Next by thread: Re: pure function with optional number of arguments