Message Boards Message Boards

1
|
5256 Views
|
3 Replies
|
4 Total Likes
View groups...
Share
Share this post:

I need somefunction[{f,g,h},{1,2,3}] => {f[1],g[2],h[3]}

Posted 10 years ago
POSTED BY: joris verrips
3 Replies
Posted 10 years ago

Hi Ilian,

Thanks a lot man, just what I need!

Joris

POSTED BY: joris verrips
In[3]:= MapThread[Compose, {{f, g, h}, {1, 2, 3}}]

Out[3]= {f[1], g[2], h[3]}

See this thread for alternative ways.

POSTED BY: Ilian Gachevski
Posted 10 years ago

Maybe this will work?

k[n_, m_] := n[[#]] @ m[[#]] & /@ Range[Length[n]]

Output:

k[{f, g, h}, {1, 2, 3}]
{f[1], g[2], h[3]}
POSTED BY: Priyan Fernando
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract