On Mon, Sep 28, 2009 at 5:23 AM, Jarkko Oranen <chous...@gmail.com> wrote:
> What happens is, when you call (mfloat + 1 2) the macro evaluates ('+ > (float 1) (float 2)), ie. it calls the *symbol* + with parameters 1.0 > and 2.0. Symbols, when used as functions, look themselves up in > whatever associative thing you give them as the first parameter, OR > return the second parameter in case of lookup failure. So, ('+ 1.0 > 2.0) evaluates to 2.0, which is the macro expansion. and as 2.0 > evaluated is 2.0, it is the actual result. Very sneaky. Why is invoking a symbol returning the second argument even when the first is not an associative thing at all? It should probably return the second argument (defaulting to nil) on not-found but not on genuine errors. A ClassCastException java.lang.Float cannot be cast to clojure.core.IAssoc (or whatever) would have been more informative in this case. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---