wolfram mathematica - Passing parameters stored in a list to expression -
how can pass values given expression several variables? values these variables placed in list needs passed expression.
your revised question straightforward, simply
f @@ {a,b,c,...} == f[a,b,c,...] where @@ shorthand apply. internally, {a,b,c} list[a,b,c] (which can see using fullform on expression), , apply replaces head, list, new head, f, changing function. operation of apply not limited lists, in general
f @@ g[a,b] == f[a,b] also, @ sequence does
f[sequence[a,b]] == f[a,b] so, instead
f[ sequence @@ {a,b}] == f[a,b] which while pedantic seeming can useful.
edit: apply has optional 2nd argument specifies level, i.e.
apply[f, {{a,b},{c,d}}, {1}] == {f[a,b], f[c,d]} note: shorthand apply[fcn, expr,{1}] @@@, discussed here, specify other level description need use full function form.
Comments
Post a Comment