Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2002
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*November
*December
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2002

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

Search the Archive

Re: Thread? Through? Operate?

  • To: mathgroup at smc.vnet.net
  • Subject: [mg32403] Re: Thread? Through? Operate?
  • From: bghiggins at ucdavis.edu (Brian Higgins)
  • Date: Sat, 19 Jan 2002 01:16:38 -0500 (EST)
  • References: <a28b6v$h3h$1@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

Johannes, 

Here is one way using replacement rules:

f = {expr1 , expr2 , expr3};
arg = {arg1, arg2, arg3};

Transpose[{f, arg}] /. {a_, b_} -> a[b]

{expr1[arg1], expr2[arg2], expr3[arg3]}

Cheers,

Brian




"Johannes Ludsteck" <johannes.ludsteck at wiwi.uni-regensburg.de> wrote in message news:<a28b6v$h3h$1 at smc.vnet.net>...
> Dear MathGroup members,
> I have a list of n unnamed functions
> 
> f = {expr1 &, expr2 &,... ,exprn &}
> (each function has exactly one arguement.
> and a list of n arguments.
> 
> arg = {arg1, arg2,... ,argn}
> 
> I simply want to apply each function expri &
> to the respective argument argi in order 
> to obtain the list of function values fi.
> Is there no more elegant way than the following one?
> 
> Map[#[[1]][#[[2]]]&, Transpose[{f,arg}]
> 
> Thanks,
> 	Johannes
> 
> <><><><><><><><><><><><><><><><><><>
> Johannes Ludsteck
> Institut fuer Volkswirtschaftslehre
> Lehrstuhl Prof. Dr. Moeller
> Universitaet Regensburg
> Universitaetsstrasse 31
> 93053 Regensburg
> Tel +49/0941/943-2741


  • Prev by Date: Re: Thread? Through? Operate?
  • Next by Date: RE: Thread? Through? Operate?
  • Previous by thread: Re: Thread? Through? Operate?
  • Next by thread: RE: Thread? Through? Operate?