Skip to main content

List of functions to list of parameters


I am working in a Dataset and I need to create a function for a ChartStyle option of a BarChart that takes a list of the items to be plotted. I would like to lighten the plot style colour by the value of the item to be plotted. I have created a function that gets me the list of functions for each PlotStyle.


Function[{value}, Nest[Lighter, #, 3 - value]] & /@ {Yellow, Orange, Blue}

value will be an integer between 0 and 3 inclusive. Is there some use of Through or Outer or Inner or something that will map a list of length to each position in this list of functions such that:


{f1, f2, f3}[{x1, x2, x3}] -> {f1[x1], f2[x2], f3[x3]} 

This is in a Dataset query so I'm hoping for something concise that is easy to read and that is a one liner with the function list definition given above.



Answer




Inner[#1[#2] &, {f1, f2, f3}, {x1, x2, x3}, List]

(* {f1[x1], f2[x2], f3[x3]} *)

#[[1]][#[[2]]] & /@
Transpose[{{f1, f2, f3}, {x1, x2, x3}}]

(* {f1[x1], f2[x2], f3[x3]} *)

Comments