MathGroup Archive 2011

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

Search the Archive

Re: Mapping to Create Nested Loops

  • To: mathgroup at smc.vnet.net
  • Subject: [mg119407] Re: Mapping to Create Nested Loops
  • From: Szabolcs Horvát <szhorvat at gmail.com>
  • Date: Thu, 2 Jun 2011 07:16:06 -0400 (EDT)
  • References: <is57n9$dgk$1@smc.vnet.net>

On 2011.06.01. 13:27, Bob Hanlon wrote:
> GatherBy[myArray, #[[3]]&]
>
> GatherBy[#, #[[3]]&]&  /@ myListOfArrays
>
>

Is this kind of use of nested functions with # guaranteed to be safe 
(let's disregard readability concerns for now)?

It appears that # indeed is always the argument of the innermost 
function, but I couldn't find this stated in the docs.  Instead, it's 
suggested in the docs (page for Slot) to use named arguments with nested 
functions (but those aren't without name-conflict / localization issues 
either)


  • Prev by Date: Error in Compile
  • Next by Date: Re: FixedPoint[Cos, 1.0]
  • Previous by thread: Re: Mapping to Create Nested Loops
  • Next by thread: Re: Mapping to Create Nested Loops