Right now, Clojure is fighting its way to get to Java-like performance for numerics, and that involves emitting primitive numbers and operations whenever possible. I'm afraid that would be utterly incompatible with turning numbers into functions - that would be at least two levels of indirection (numbers would have to be objects, and these objects would have to implement IFn).
Nice idea on a conceptual level, though. On 26 March 2013 18:18, david sheldrick <d.j.sheldr...@gmail.com> wrote: > I don't like the idea of infix math as a reader macro. Yeah prefix is weird > to read for complex expressions, but in such rare cases there are ordinary > macros that let you do infix math. Use them. > > An interesting thought I had the other day regarding infix math: > It would be possible for Clojure to provide it's own implementations of the > basic number classes (Integer, Long, Double, etc) that implement IFn such > that they take a function and another number and apply themselves and the > other number to the function. > > Then we could just write (2 + 5). > > I imagine this has all kinds of downsides regarding optimisation and what to > do with numbers that get emitted from java code and so forth. > > On Monday, 25 March 2013 10:52:23 UTC, poetix wrote: >> >> I really like the look of this: >> >> http://readable.sourceforge.net/ >> >> which defines a completely reversible transformation between e.g. >> >> define fibfast(n) >> if {n < 2} >> n >> fibup(n 2 1 0) >> >> and >> >> (define (fibfast n) >> (if (< n 2) >> n >> (fibup n 2 1 0))) >> >> >> and wonder how difficult it would be to support it (or something like it) >> in/for Clojure. A coffeescript-like approach might be a good first step. >> >> Any thoughts? >> >> Dominic > > -- > -- > 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 > --- > 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 clojure+unsubscr...@googlegroups.com. > For more options, visit https://groups.google.com/groups/opt_out. > > -- -- 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 --- 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 clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.