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

[REBOL] Re: Re(2): Setting Block Data

From: ingo:2b1 at: 29-Nov-2000 11:37

Hi Anton, let's step through it: REBOL/Core 2.4.37.4.2 30-Oct-2000 Copyright 2000 REBOL Technologies. All rights reserved.
>> ; set some values >> info: [db [[detail "detail one"] [detail "detail two"]]]
== [db [[detail "detail one"] [detail "detail two"]]]
>> a: "info db 1 detail"
== "info db 1 detail"
>> v: #"q"
== #"q" ; now try what happens
>> probe to-set-path a v
info/db/1/detail: == #"q"
>> reduce [to-set-path a v]
== [info/db/1/detail: #"q"]
>> form reduce [to-set-path a v]
== "info/db/1/detail: q"
>> do form reduce [to-set-path a v]
; here rebol says goodbye, have you spotted the problem ??? Here the last 3 lines again:
>> form reduce [to-set-path a v]
== "info/db/1/detail: q"
>> do form reduce [to-set-path a v]
; !!! form has formed #"q" to just "q", so when the ; is 'DOne in the next line, the path will be set to ; the value returned by the function 'q which happens ; to shutdown the interpreter ... ; A working version would be: do bind reduce [to-set-path a v] 'info ; 'do can do the block ; 'bind is needed, so that the block is evaluated in the right ; context .... ; And to write the corresponding function set-path is left to the ; reader (meaning, I don't know how to do it best, either ;-) I hope that clarifies it a bit ... kind regards, Ingo Once upon a time Anton spoketh thus: