Re: Distinquishing #'s in nested pure functions
- To: mathgroup at smc.vnet.net
- Subject: [mg126283] Re: Distinquishing #'s in nested pure functions
- From: Murray Eisenberg <murray at math.umass.edu>
- Date: Sat, 28 Apr 2012 05:29:38 -0400 (EDT)
- Delivered-to: l-mathgroup@mail-archive0.wolfram.com
- References: <201204260933.FAA05752@smc.vnet.net> <201204271048.GAA20037@smc.vnet.net>
- Reply-to: murray at math.umass.edu
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 at 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
- References:
- NonlinearModelFit and Complex Data
- From: Maria <rouelli@gmail.com>
- Distinquishing #'s in nested pure functions
- From: "Dave Snead" <dsnead6@charter.net>
- NonlinearModelFit and Complex Data