Re: Improper use of slot
- To: mathgroup at smc.vnet.net
- Subject: [mg58762] Re: [mg58754] Improper use of slot
- From: yehuda ben-shimol <bsyehuda at gmail.com>
- Date: Sun, 17 Jul 2005 13:03:08 -0400 (EDT)
- References: <200507170704.DAA02666@smc.vnet.net>
- Reply-to: yehuda ben-shimol <bsyehuda at gmail.com>
- Sender: owner-wri-mathgroup at wolfram.com
Hi bob,
From your description I figure out that lst is a flat list (only one
pair of curly braces arround a list of integers).
In this case
Binomial[ Last[#], First[#]] & /@ lst
Last anf First will be applied in turn to EACH element of lst and you
will alwys get 1 as an answer, that is, mapping this oven list will
return you a list of 1's with length equal to the length of lst.
The correct format that you need for this case is
Binomial[ Last[#], First[#]] & [lst]
for example check with
lst={2,3,10};
Binomial[ Last[#], First[#]] & /@ lst//Trace
and
Binomial[ Last[#], First[#]] & [lst]//Trace
yehuda
On 7/17/05, Robert G. Wilson v <rgwv at rgwv.com> wrote:
> Help, I am trying to 'pipe' into Binomial[] two arguments which are taken from
> a list, say lst. I could do something like:
>
> ... lst= ...; Binomial[ Max[lst], Min[lst]]
>
> but I was hoping for something a little bit more elegant like:
>
> Binomial[ Last[#], First[#]] & /@ lst
>
> but that dog wont hurt. Any suggestions?
>
> Thank you in advance.
>
> Bob Wilson.
>
>
- References:
- Improper use of slot
- From: "Robert G. Wilson v" <rgwv@rgwv.com>
- Improper use of slot