Mailing List Archive: 49091 messages
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search

[REBOL] Re: lisp-like backquotes macros

From: gabriele:colellachiara at: 26-Nov-2005 11:46

Hi Henri, On Saturday, November 26, 2005, 12:49:43 AM, you wrote: HM> `[ ,value1 to-string ( to-integer ,value2 ) + 2 ] Probably Ladislav's BUILD will help; anyway, sometimes it is possible to refactor your code so that you don't need it. In the case above, for example, you could write: compose [(value1) to-string 2 + (to-integer value2)] (Well, actually, in this specific case you could just write: reduce [value1 to-string 2 + to-integer value2] because there's no reason to do the add and the string conversion at "runtime", but I assume it's just because this is a simplified example.) Also, REBOL offers another way to obtain the same goal without composing at all. use [value1' value2'] [ value1': value1 value2': to-integer value2 [value1' to-string value2' + 2] ] Using a function like my LOCALIZE in: localize [value1 value2] [ [value1 to-string 2 + to-integer value2] ] The solutions here do not solve all the cases, especially when you are composing PARSE rules; but they can give you ideas. Regards, Gabriele. -- Gabriele Santilli <> --- Colella Chiara software division ---