array referencing
[1/5] from: james::mustard::co::nz at: 2-Oct-2002 18:01
Can anyone shed some light on this behaviour:
n: 4
bob: array/initial [8 8] 1
; this works fine
bob/:n/4: 2
; this dies horribly
bob/4/:n: 2
It seems to let a variable be part of an assignment as long as it is not the
last entry in the path...
Is this a bug or a design feature??
James.
[2/5] from: tomc:darkwing:uoregon at: 2-Oct-2002 0:26
Hi James,
short answer: yes
bottom line:
can't get&set with the same word
see:
this just came up again in the last week or so:
look for the thread called "change/at"
On Wed, 2 Oct 2002, James Marsden wrote:
[3/5] from: al:bri:xtra at: 2-Oct-2002 20:05
James Marsden wrote:
> ; this dies horribly
> bob/4/:n: 2
>
> It seems to let a variable be part of an assignment as long as it is not
the last entry in the path...
> Is this a bug or a design feature??
It's a defect, I believe. I'm fairly sure it's on Rebol HQ's list of defects
to fix.
Andrew Martin
ICQ: 26227169 http://valley.150m.com/
[4/5] from: james:mustard at: 2-Oct-2002 20:57
Thanks Tom,
I seem to remember using POKE back when I first started using REBOL, haven't
had to do any array work since then.
I sat down and tried to think of a better way to handle the get/set paradox
but the existing methods seem the only viable (non-complex) methods.
Pointer notation *(....): would seem too cumbersome and non-rebolish and
redirective assignment clashes with other rebol ways of doing things.
In short, POKE is good. POKE is simple and best of all it works! :P
James.
[5/5] from: philb:upnaway at: 2-Oct-2002 17:31
Hi James,
You could try creting the array with 1 extra dimension
n: 4
bob: array/initial [8 8 1] 1
; this works
bob/4/:n/1: 2
Cheers Phil
=== Original Message ===
Thanks Tom,
I seem to remember using POKE back when I first started using REBOL, haven't
had to do any array work since then.
I sat down and tried to think of a better way to handle the get/set paradox
but the existing methods seem the only viable (non-complex) methods.
Pointer notation *(....): would seem too cumbersome and non-rebolish and
redirective assignment clashes with other rebol ways of doing things.
In short, POKE is good. POKE is simple and best of all it works! :P
James.