Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.soft-sys.math.mathematica > #2916 > unrolled thread

Re: Mapping to Create Nested Loops

Started byLeonid Shifrin <lshifr@gmail.com>
First post2011-06-02 23:12 +0000
Last post2011-06-02 23:12 +0000
Articles 1 — 1 participant

Back to article view | Back to comp.soft-sys.math.mathematica


Contents

  Re: Mapping to Create Nested Loops Leonid Shifrin <lshifr@gmail.com> - 2011-06-02 23:12 +0000

#2916 — Re: Mapping to Create Nested Loops

FromLeonid Shifrin <lshifr@gmail.com>
Date2011-06-02 23:12 +0000
SubjectRe: Mapping to Create Nested Loops
Message-ID<is95d2$62b$1@smc.vnet.net>
Hi Szabolcs,

AFAIK, it is safe, as long as inner pure anonymous  function is totally
contained in the outer, being
passed as an argument. Here is one relevant mathgroup thread:

http://groups.google.com/group/comp.soft-sys.math.mathematica/browse_thread/thread/7688b58dbd9450b7

Regarding pure functions with named arguments, I try to avoid them because
the functional abstraction
is generally leaky in Mathematica. I pointed this out here:

http://groups.google.com/group/comp.soft-sys.math.mathematica/browse_thread/thread/115b073d95999ae8

and also discussed here:

http://stackoverflow.com/questions/4920194/using-nested-slots/4922776#4922776

You may also look at the bottom of this post:

http://stackoverflow.com/questions/4430998/mathematica-what-is-symbolic-programming/4435720#4435720

for a really short but instructive example illustrating the problem.

Cheers,
Leonid



2011/6/2 Szabolcs Horv=E1t <szhorvat@gmail.com>

> 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)
>
>

[toc] | [standalone]


Back to top | Article view | comp.soft-sys.math.mathematica


csiph-web