MathGroup Archive 2005

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Improper use of slot

  • To: mathgroup at smc.vnet.net
  • Subject: [mg58774] Re: Improper use of slot
  • From: Peter Pein <petsie at dordos.net>
  • Date: Sun, 17 Jul 2005 13:03:21 -0400 (EDT)
  • References: <dbd0vm$2s4$1@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

Robert G. Wilson v schrieb:
> 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.
> 

Hi Bob,

use the function application (f[lst] or f@lst) instead of mapping (f/@lst)!
Examples:

In[1]:= Binomial[Max[#], Min[#]]&@{2, 4, 3, 5}
Out[1]= 10

In[2]:=Simplify[
    Binomial[Max[#], Min[#]]& /@ {{2, 4, 3, 5}, {k, n}},
  n > k]
Out[2]= {10, Binomial[n, k]}

Peter

P.S. sorry, if this message arrives twice; I've got a temporary problem
with my mail/news client.
-- 
Peter Pein
Berlin
http://people.freenet.de/Peter_Berlin/


  • Prev by Date: Re: How to create a new Form
  • Next by Date: Re: Improper use of slot
  • Previous by thread: Re: Improper use of slot
  • Next by thread: Re: Improper use of slot