Accessing nested Blocks
[1/4] from: jthomas:apollo:evo:it at: 3-Nov-2000 16:29
Hello,
having this
myblock: [[one [1 2 3]][two [4 5 6]][three [7 8 9]]]
I can extract a value and put it in
myvalue: myblock/1/2/3
print myvalue
>> 6
but if I change myvalue: the result is only local, not global to myblock, so
is there a way to assign the content of myblock, like a pointer, to the
variable, so that
myvalue: 12
will change the content in myblock/1/2/3 ?
Thanks ;-)
Bye
--
Joachim Thomas - [jthomas--mail--evo--it] - ICQ 18088459
Amiga1260+Amiga4060PPC604
Member of ATO (italian Division) http://bilbo.di.unipi.it/~ato-it & Phoenix Consortium
Concerti - Gruppi Musicali & Locali http://concertitalia.supereva.it
Virtual PHOTO Gallery http://www.terzomercato.com/free/jt_home
It took them 15 years to catch up...Now they never will.
-- Bill McEwen/T-Shirt Slogan at AmiWest
[2/4] from: al::bri::xtra::co::nz at: 4-Nov-2000 8:07
Joachim Thomas wrote:
> having this
>
> myblock: [[one [1 2 3]][two [4 5 6]][three [7 8 9]]]
>
> I can extract a value and put it in
>
> myvalue: myblock/1/2/3
> but if I change myvalue: the result is only local, not global to myblock,
so
> is there a way to assign the content of myblock, like a pointer, to the
variable...
>> myblock: [[one [1 2 3]][two [4 5 6]][three [7 8 9]]]
== [[one [1 2 3]] [two [4 5 6]] [three [7 8 9]]]
>> myvalue: myblock/1/2/3
== 3
>> print myvalue
3
>> myblock/1/2/3: "I'm a new value!"
== [1 2 "I'm a new value!"]
>> myblock
== [[one [1 2 "I'm a new value!"]] [two [4 5 6]] [three [7 8 9]]]
Andrew Martin
Caution: Only Rebol spoken here...
ICQ: 26227169
http://members.nbci.com/AndrewMartin/
[3/4] from: g:santilli:tiscalinet:it at: 4-Nov-2000 13:51
Hello Joachim!
On 03-Nov-00, you wrote:
JT> is there a way to assign the content of myblock, like a
JT> pointer, to the variable, so that
JT> myvalue: 12
JT> will change the content in myblock/1/2/3 ?
A way to do it might be:
>> myblock: [[one [1 2 3]][two [4 5 6]][three [7 8 9]]]
== [[one [1 2 3]] [two [4 5 6]] [three [7 8 9]]]
>> pointer: at myblock/1/2 3
== [3]
>> change pointer 5
== []
>> myblock
== [[one [1 2 5]] [two [4 5 6]] [three [7 8 9]]]
But the real question is, why do you need to do so?
Regards,
Gabriele.
--
Gabriele Santilli <[giesse--writeme--com]> - Amigan - REBOL programmer
Amiga Group Italia sez. L'Aquila -- http://www.amyresource.it/AGI/
[4/4] from: jthomas:apollo:evo:it at: 5-Nov-2000 13:51
Hello Gabriele
On 04-Nov-00, Gabriele Santilli wrote:
>GS Hello Joachim!
>GS
<<quoted lines omitted: 12>>
>GS == [[one [1 2 3]] [two [4 5 6]] [three [7 8 9]]]
>GS>> pointer: at myblock/1/2 3
thanx
... I didn't consider the word AT.... :-/
>GS == [3]
>GS>> change pointer 5
<<quoted lines omitted: 3>>
>GS
>GS But the real question is, why do you need to do so?
could be a more readable way to write accesses to data in little databases..
Regards
--
Joachim Thomas - [jthomas--mail--evo--it] - ICQ 18088459
Amiga1260+Amiga4060PPC604
Member of ATO (italian Division) http://bilbo.di.unipi.it/~ato-it & Phoenix Consortium
Concerti - Gruppi Musicali & Locali http://concertitalia.supereva.it
Virtual PHOTO Gallery http://www.terzomercato.com/free/jt_home
Amiga makes IT possible, Mac makes it expensive
and Win95 just makes Bill Gates rich...
-- Christoph Krakowski
Notes
- Quoted lines have been omitted from some messages.
View the message alone to see the lines that have been omitted