On Mar 31, 2014, at 5:59 PM, François Rey <[email protected]> wrote: > Forget that, my code does not work with 'z too, obviously. > Too late, time to go to bed for me....
But my code *does* work with 'z as long as z is also the variable used in the expression, which is what I assume was intended: (defn functionalise [ex var] (eval (list 'fn (vector var) ex))) (def ex '(+ 1 z)) (def exf (functionalise ex 'z)) (exf 3) ;=> 4 You could also generalize this for expressions with any number of variables, but again I'm assuming that you know what the names of the variables are. -Lee -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to [email protected] Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups "Clojure" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.
