[Date Index] [Thread Index] [Author Index]
Best practice passing expressions to functions
Hi I want to write procedures that accept expressions as parameters and be able define functions based on these expressions, i.e. f[exp_]:=Module[ "g[x_] := exp " ] The code between the " " should clarify what I intend to do. Calling f[x^2-2x+4] should lead to the definition of a function (or pattern) g[x_]:=x^2-2x+4; What's the best way to do this? How can I do this without being dependent on the variables used in the expressions ("x")? Thank you. Remo A.