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: [mg99024] Re: [mg99003] Re: pure function with optional number of arguments
  • From: Leonid Shifrin <lshifr at gmail.com>
  • Date: Fri, 24 Apr 2009 03:47:32 -0400 (EDT)
  • References: <200904220912.FAA13452@smc.vnet.net> <gsmrus$ger$1@smc.vnet.net>

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
>



  • Prev by Date: Re: Help with a possible bug
  • Next by Date: Re: FindFit tips
  • Previous by thread: Re: Re: pure function with optional number of arguments
  • Next by thread: Re: Re: pure function with optional number of arguments