2

Most list manipulations can be done with Flatten, Partition and Take. I didn't managed to use them for my need: I'd like to know if there is nice solution to map a function of several variables to a list, and other variables. For examples, given:

f[a_,b_,c_]=a+b+c;

and

list={2,3};

I'd like to calculate f[a,2,3]

Of course, I could use

f[a,list[[1]],list[[2]]]

but I'm looking for something a bit more general, such as

f[a,MysteriousFunction[list]]
(* wished output: a+1+2 *)

Does such a MysteriousFunction exist?

anderstood
  • 14,301
  • 2
  • 29
  • 80

1 Answers1

1
f[a_, b_, c_] = a + b + c;
list = {2, 3};
f[a, Sequence @@ list]
(* 5 + a *)
Dr. belisarius
  • 115,881
  • 13
  • 203
  • 453