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

[REBOL] Re: questions about VID and parse.

From: gscottjones:mchsi at: 10-Mar-2002 13:56

Hello, Stephane, From: "Bansard Stephane"
> Beginner questions... > > How can I display the content of a series as "text" in Rebol/View? > ex: > a: ["first" "second"] > I want > first > second > > I tried: view layout [text foreach i a [i]], but in this case, first is
> by second.
I assume that you are wishing to dynamically create text-type labels depending on the contents of a block series. That is a little trickier than statically laying them out, as you may have discovered. Here is one way to do it (liberally commented): a: ["first" "second"] ;clear a fresh block to receive the dynamic layout information layout-data: copy [] ;loop through the series foreach datum a [ ;append the dialect word "text" to the layout data block append layout-data [text] ;append the information to be displayed by the text word append layout-data datum ] ;layout-data now is a block ready to be interpreted by the ;view/vid & layout dialect parser view layout layout-data
> --- > Also another question about parse. How to use a string as a pattern? > parse "hello world" ?? > I want ["hello" "rld"] > By what should I replace ?? to make this sequence ("wo" in this example) > considered as a whole.
I am unsure about the answer to the second question. I suspect that this will require a "rule" but I am unsure how to word the rule (my parse skills have grown a tad rusty during a resent REBOL programming abscence).
> Thanks!
You are welcome. Hope I assumed correctly on your first question. Don't hesitate to re-ask if I asumed incorrectly. --Scott Jones