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

[REBOL] Re: Attribution to a Word with Pat

From: joel:neely:fedex at: 14-Aug-2002 13:16

Hi, Philippe, Philippe Oehler wrote:
> Hi, > > It must surely be a simple question but i just dont have the answer.. > > How to attribute a value to a element of a serie or of a block ? > > I already know that i could make > > theblock/5: "bonjour mon amour" > and the 5th element of theblock is changed.. ok. > > But how could I change or "attribute" a value to a element that is variable > > i: 5 > theblock/i: "bonjour mon amour" doesnt work. >
Here's one way
>> theblock: array/initial 8 "wait"
== ["wait" "wait" "wait" "wait" "wait" "wait" "wait" "wait"]
>> i: 5
== 5
>> poke theblock i "bonjour mon amour"
== ["wait" "wait" "wait" "wait" "bonjour mon amour" "wait" "wait" wait ]
>> theblock
== ["wait" "wait" "wait" "wait" "bonjour mon amour" "wait" "wait" wait ]
>>
and here's another
>> theblock: array/initial 8 "wait"
== ["wait" "wait" "wait" "wait" "wait" "wait" "wait" "wait"]
>> change at theblock i "bonjour mon ami"
== ["wait" "wait" "wait"]
>> theblock
== ["wait" "wait" "wait" "wait" "bonjour mon ami" "wait" "wait" wait ] HTH! -jn- -- ; Joel Neely joeldotneelyatfedexdotcom REBOL [] do [ do func [s] [ foreach [a b] s [prin b] ] sort/skip do function [s] [t] [ t: "" foreach [a b] s [repend t [b a]] t ] { | e s m!zauafBpcvekexEohthjJakwLrngohOqrlryRnsctdtiub} 2 ]