Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.soft-sys.math.mathematica > #9848
| From | David Reiss <dbreiss@gmail.com> |
|---|---|
| Newsgroups | comp.soft-sys.math.mathematica |
| Subject | Re: Distinquishing #'s in nested pure functions |
| Date | 2012-04-28 09:30 +0000 |
| Organization | Steven M. Christensen and Associates, Inc and MathTensor, Inc. |
| Message-ID | <jngdc5$ot$1@smc.vnet.net> (permalink) |
| References | <201204260933.FAA05752@smc.vnet.net> <jndtj1$jit$1@smc.vnet.net> |
For situations like this I always use explicit calls to Function[...],
though for the innermost our function I may use the shorthand #, &
form. In addition to avoiding potential ambiguities, it makes the
code readable.
--David
On Apr 27, 6:49 am, "Dave Snead" <dsne...@charter.net> 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
Back to comp.soft-sys.math.mathematica | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Distinquishing #'s in nested pure functions "Dave Snead" <dsnead6@charter.net> - 2012-04-27 10:49 +0000 Re: Distinquishing #'s in nested pure functions David Reiss <dbreiss@gmail.com> - 2012-04-28 09:30 +0000 Re: Distinquishing #'s in nested pure functions A Retey <awnl@gmx-topmail.de> - 2012-04-28 09:31 +0000
csiph-web