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

[REBOL] Replace, select, find and stuff

From: hallvard::ystad::oops-as::no at: 30-Apr-2005 17:48

Hi list I need to replace a value in a hash!, and find I cannot use 'replace. The hash is like this:
>> a: make hash! [1 "A" 2 "B" 3 "C" 4 "D"]
== make hash! [1 "A" 2 "B" 3 "C" 4 "D"] Now let's say I have
>> e: "E"
== "E" and that I want to replace "C" with "E" in 'a. I'd like to do something like this: replace/select a 3 e but instead, I have to do two statements, like this:
>> remove next find a 3
== make hash! [4 "D"]
>> insert next find a 3 e
== make hash! [4 "D"] Then we get
>> a
== make hash! [1 "A" 2 "B" 3 "E" 4 "D"] But maybe someone knows how to achieve this in a simpler manner? HY