MathGroup Archive 1996

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

Search the Archive

Re: Question: Applying a list of funcs to a list of expressions

  • Subject: [mg2929] Re: Question: Applying a list of funcs to a list of expressions
  • From: killough at convex.convex.com (Leland D. Killough)
  • Date: 13 Jan 1996 05:14:22 -0600
  • Approved: usenet@wri.com
  • Distribution: local
  • Newsgroups: wri.mathgroup
  • Organization: Convex Technology Center of Hewlett Packard, Richardson, Tx USA
  • Sender: mj at wri.com

In article <4d20el$ejt at dragonfly.wri.com>,
David Rosky <groskyd at gv.ssi1.com> wrote:
>
>I would like to specify a list of functions such as:
>
>funcs = {f1, f2, f3}
>
>and a list of values to which the functions will be
>applied:
>
>vals = {val1, val2, val3}
>
>I would then like to apply to each function to each corresponding value
>respectively to obtain the following list:
>
>DesiredOutputList = {f1[val1], f2[val2], f3[val3]}
>
>


You can use Inner and HeadCompose to do the trick:


listfunc[funcs_,vals_] := Inner[HeadCompose, funcs, vals, List]


Which makes List the addition operator, and HeadCompose the
multiplication operator.

Lee Killough
killough at convex.com






  • Prev by Date: Re: Question: Applying a list of funcs to a list of expressions
  • Next by Date: Re: Question: Applying a list of funcs to a list of expressions
  • Previous by thread: Re: Question: Applying a list of funcs to a list of expressions
  • Next by thread: Re: Question: Applying a list of funcs to a list of expressions