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

[REBOL] Re: Replacing placeholders?

From: Tom:Conlin:gmai:l at: 8-Aug-2007 18:36

Tim Johnson wrote:
> On Wednesday 08 August 2007, Carlos Lorenz wrote: >> Kai, >> >> I am afraid a cannot go further on advising you since I am not a heavy user >> of pdf-maker. >> Anyway are you using COMPOSE to evaluate data and surrounding them with >> parens as Tim said? > <blush> I've been extremely busy here and I've got a little time for this - > first - a disclaimer - I whipped up that code in preperation for > implementing it for a client. But my partner ended doing the functionality > with perl. Furthermore, I've deleted much of *this* thread from my mailer. > > Let me suggest that you just play with compose for a bit, without your > target in mind. Just a have a bit of fun with it. What compose allows you to > do is to create a data structure, evaluate it as much as you like and > change values within that data structure targeted by parenthesis. > > Since I am not myself an expert with compose, and if I don't write rebol for > a week, I get behind the curve even more, let me propose a problem and > perhaps the solution will edify me and help you: > > Here's the problem, define a block with a parenthesized word and evaluate it > as a place holder > names: ["Tim" "Carlos" "Kai"] > == ["Tim" "Carlos" "Kai"] >>> template: [My name is (name)] > == [My name is (name)] >>> foreach name names[print compose template] > ** Script Error: name has no value > ** Near: name > ;; I *don't* know the solution myself, but finding it will be most helpful for > ;; both of us > cheers > tim
names: ["Tim" "Carlos" "Kai"] template: [My name is (first names)] while[not tail? names][probe compose template names: next names] [My name is "Tim"] [My name is "Carlos"] [My name is "Kai"] == [] names: head names while[not tail? names][print form compose template names: next names] My name is Tim My name is Carlos My name is Kai == []
>>