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

[REBOL] Re: Problem with paren

From: carl:cybercraft at: 2-Feb-2003 9:37

Hi Patrick, On 02-Feb-03, pat665 wrote:
> Hi List, > I am trying to build a block including some parenthesis and I am > surely missing something. It seems I am not able to transform the > words into parens. > See that: > values: [ 7 "/" "(" 1 "+" 2 ")"] test: copy [] > foreach v values [either integer! = type? v [append test v] [append > test to-word v]] > I have tried 'compose, 'compose/deep but I am at a loss... > Any clue?
At one point there you're attempting to have this in your test block... [ 7 / ( ] which just won't work in REBOL, as you can't have half a paren. One way around this would be to append a paren, then insert your values into it. ie...
>> blk: []
== []
>> append/only blk make paren! []
== [()] So far, so good, but when we try to append to the paren we get this...
>> append last blk 1
** Script Error: tail expected series argument of type: series port ** Where: append ** Near: insert tail series :value yet, oddly, insert works...
>> insert last blk 1
== ()
>> blk
== [(1)] (Is this a bug people?) To get around that you could at first append a block then convert it to a paren when you've appended what you need to. ie...
>> blk: []
== []
>> append/only blk []
== [[]]
>> append last blk 1
== [1]
>> change/only back tail blk to-paren last blk
== []
>> blk
== [(1)] Have fun... -- Carl Read