> Is there anyway to write a macro/function that acts as a function when
> necessary (so it can be passed as an argument), but expands into a
> macro (for speed) when deemed possible?

I don't think this is possible without some sort of support for a
macro/function duality in core Clojure. In the current implementation
(read: you should not rely on this fact) macros' are simply functions
with the #^{:macro true} metadata attached. Since you can't have a
symbol refer to two different values, I don't see any way to do this
except if you re-bind 'and' in a local context:

(let [and (fn and [x & xs]
               (if x (if (nil? xs) true (and xs)) false))]
   (apply and [true true false]))

Probably the closest you can come to this without redefining and is
Konrad's suggestion:

 #(and %1 %2)

/mike.

--~--~---------~--~----~------------~-------~--~----~
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
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to