On Saturday 29 November 2008 22:11, Jeff Bester wrote: > ... > > If you are translating formulas it might be worth investing the time > to create a macro to convert from infix to prefix with precedence > rules, as well as, creating new operators. I think Peter Norvig > covers something akin to this in PAIP. This is where any lisp truly > shines; that is using macros to express Domain Specific Languages. > That is at compile/load time morph the code to allow new syntax in the > language.
I don't think this strategy will work, 'cause you're operating behind the Clojure reader. If you really want to pursue non-S-expression parsing, then I believe you must also write a lexical analyzer and operate from the character level. Prolog, Scala and even Prover9 (a first-order logic theorem prover) have user-definable operators with user-specified precedence, associativity and "fixity" (pre-, in- or post-). It's certainly intriguing from the perspective of creativity and expressivity, but I'm not sure how good an idea it is to allow such complete and radical redefinition of a program's language and syntax. I do, however, still support (and actively desire) Common-Lisp-style programmable reader macros. I don't accept the language fragmentation argument, frankly. I would not expect it to be used to change Clojure itself just to suit personal tastes, but rather to enable the processing of prefix / S-Expression languages that are not compatible with Clojure per se (two existing examples, one of key importance to me, come to mind: CycL and CLIF; both are not readable with Clojure but could be if the reader had Common-Lisp-like programmable reader macros). > ... Randall Schulz --~--~---------~--~----~------------~-------~--~----~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/clojure?hl=en -~----------~----~----~----~------~----~------~--~---