On Tue, Nov 2, 2010 at 8:55 AM, Konrad Hinsen <konrad.hin...@fastmail.net>wrote:
> On 02.11.2010, at 13:34, Ken Wesson wrote: > > > This wouldn't work?: > > > > (with-monad sequence-m > > (defn ntuples [n xs] > > (apply (m-lift n list) (replicate n xs)))) > > No. > > > (If m-lift is a macro that requires the arity arg to be known at > macroexpansion time: > > > > (with-monad sequence-m > > (defn ntuples [n xs] > > (apply (eval `(m-lift ~n list)) (replicate n xs)))) > > > > instead. Icky, mind you.) > > That should work. But once you are at that level of Lisp proficiency, you > should also have heard the "eval is evil" lesson a few times ;-) Yeah, I wouldn't actually use it for something like that in production code. In this case I'd use m-seq. In fact the only time I've used eval in production code, thus far, was in a system that had to generate new functions on the fly based on data only available at runtime, and for efficiency reasons those needed to become bytecode and potentially subject to JIT compilation. So there was a compiler function that took some data, constructed (fn ...) forms and eval'd them, and returned the resulting function objects to its caller. -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en