Re: slot argument weirdness
- To: mathgroup at smc.vnet.net
- Subject: [mg83949] Re: [mg83918] slot argument weirdness
- From: DrMajorBob <drmajorbob at bigfoot.com>
- Date: Wed, 5 Dec 2007 07:12:48 -0500 (EST)
- References: <18507774.1196798146692.JavaMail.root@m35>
- Reply-to: drmajorbob at bigfoot.com
What's wrong with:
m = {{#1, #2}, {#2, #1}} &;
myMatrix2 = Apply[m, v]
{{2, 5}, {5, 2}}
Bobby
On Tue, 04 Dec 2007 03:29:07 -0600, Jerry <JLK2941 at yahoo.com> wrote:
> I have to produce some bulky matrices which are described by
> two parameters and it seems the easiest way to produce them
> is as follows (I took out all the complexity and just left
> in the slots to illustrate my problem). v is the parameter
> array.
>
> v = {2, 5};
> myMatrix=Apply[{{#1, #2}, {#2, #1}} &, v]
>
> giving {{2, 5}, {5, 2}} and all is well.
>
> But since the actual form in the first argument in Apply is
> really a large messy thing, I thought I'd produce it just
> once in the notebook and represent it with:
>
> m = {{#1, #2}, {#2, #1}};
>
> But geez, this doesn't work at all:
>
> MyMatrix2= Apply[m &, v]
>
> gives {{#1, #2}, {#2, #1}}
>
> I've tried a lot of things to make this work but have failed
> completely. If someone can tell me that there is absolutely
> no representation of the slot configuration that will do
> what I want, then I can quit trying. Or is there? Thanks for
> any info.
>
>
-- =
DrMajorBob at bigfoot.com