Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

5
  • 1
    $\begingroup$ Warning! Module[{x, expr, body}, expr = 2 x; Function[x, body] /. body -> expr ] won't make a correct Function. (it was also what I tried) $\endgroup$ Commented Mar 6, 2013 at 20:42
  • $\begingroup$ @Szabolcs Yes; I tried to address this in my answer below. $\endgroup$ Commented Mar 6, 2013 at 20:43
  • $\begingroup$ @Mr.Wizard I only got to reading it now :) $\endgroup$ Commented Mar 6, 2013 at 20:47
  • $\begingroup$ @Szabolcs It is Module that we are trying to fool here, not Function, thus this behavior - see my comment below Mr.Wizard's answer. $\endgroup$ Commented Mar 6, 2013 at 20:51
  • $\begingroup$ @Szabolcs Thanks for pointing that out - I was in a hurry and overlooked how important the Module part of the question was... $\endgroup$ Commented Mar 6, 2013 at 23:26