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

[REBOL] Re: Setting Block Data

From: mdb:gci at: 22-Nov-2000 16:19

Hello Mike, An interesting problem, still got me stumped but i managed to come up with this partial solution: set-field: func [a v] [do form reduce [to-set-path a v]]
>> info: [db [[detail "detail one"] [detail "detail two"]]]
== [db [[detail "detail one"] [detail "detail two"]]]
>> set-field "info db 1 detail" 444
== [detail 444]
>> set-field "info db 2 detail" 555
== [detail 555]
>> info
== [db [[detail 444] [detail 555]]]
>>
but only seems to work with numbers and not strings ? I'm very interested to see if you find a solution. Mike. =========================================== I am trying the following: info: [ db [ [ detail "detail one" ] [ detail "detail two" ] ] ] set-field: func [ apath [path!] v ] [ do [ to-set-path reduce [ :apath 'detail ] :v ] ]
>> set-field 'info/db/1 "newdata"
== "newdata"
>> info
== [ db [ [detail "detail one"] [detail "detail two"] ] ] I was hoping to change the value assigned to info/db/1/detail . Does anyone have any ideas? Mike Yaunish [mike--yaunish--home--com]