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


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

Re: Distinquishing #'s in nested pure functions

Started byMurray Eisenberg <murray@math.umass.edu>
First post2012-04-28 09:33 +0000
Last post2012-04-28 09:33 +0000
Articles 1 — 1 participant

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

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: Distinquishing #'s in nested pure functions Murray Eisenberg <murray@math.umass.edu> - 2012-04-28 09:33 +0000

#9859 — Re: Distinquishing #'s in nested pure functions

FromMurray Eisenberg <murray@math.umass.edu>
Date2012-04-28 09:33 +0000
SubjectRe: Distinquishing #'s in nested pure functions
Message-ID<jngdgu$pl$1@smc.vnet.net>
The symbol # is an abbreviation for #1. You can have #1, #2, etc.

And actually, #1, #2, etc., are in turn abbreviations for the FullForm 
names Slot[1], Slot[2], etc.

On 4/27/12 6:48 AM, Dave Snead wrote:
> Hi,
>
> Is there a way to distinguish the #'s in nested pure functions?
>
> As a simple example:
>
> f[x_, y_] := x - y
>
> Select[{1, 2, 3}, (f[#, #]&  /@ {-1, -2, -3}) == {3, 4, 5}&]
>
> I want the 1st # to correspond with the outer&  (the equal)
> and the 2nd # with the inner&  (the map)
> The answer in this example should by {2}
> (of course, the statement as written above does not do the job)
>
> Can Mathematica distinguish these #'s?
>
> Thanks in advance,
> Dave Snead
>
>

-- 
Murray Eisenberg                     murray@math.umass.edu
Mathematics & Statistics Dept.
Lederle Graduate Research Tower      phone 413 549-1020 (H)
University of Massachusetts                413 545-2859 (W)
710 North Pleasant Street            fax   413 545-1801
Amherst, MA 01003-9305

[toc] | [standalone]


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


csiph-web