"Jim foo.bar" <jimpil1...@gmail.com> writes: Hi Jim,
>> One example that does things like constant-folding like macrology is >> the unit conversion macro in Let Over Lambda that compiles to >> constants if both value and unit are given literally (recursively). > > unit conversion! this is exactly what i had in mind!!! when doing unit > conversion we have all the numbers + the formula upfront! where can I > find this macro that you're describing? Have you got the book? Could > you copy and paste it here please? You are lucky, the early chapters are online. See unit-of-time in http://letoverlambda.com/index.cl/guest/chap3.html defunits and defunits-chaining in http://letoverlambda.com/index.cl/guest/chap5.html There's also a Clojure version floating around the web, and I think I've seen it in some of Stu's presentations. But I think that doesn't try to compile to constants, e.g., it omits the "defunits chaining" part. > could the same be done in Java? I think, Java compilers do a bit of constant folding for things like int x = 1 + 2 * 3; // -> int x = 7; or final static int MAX=10; // ... int x = MAX + 1; // -> int x = 11; Bye, Tassilo -- 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