[REBOL] Re: array coordinates
From: ryanc:iesco-dms at: 8-Aug-2001 14:28
Try some of these...
>> board-state/2/3
== k
>> x: 2 y: 7
== 7
>> board-state/:y/:x
== j
>> state: func [x y] [pick pick board-state y x]
>> state 3 4
== 0
>>
--Ryan
Carl Youngblood wrote:
> I've created a simple array block like this:
>
> board-state: [
> [ r r r r ]
> [ r r k r ]
> [ r r r r ]
> [ 0 0 0 0 ]
> [ 0 0 0 0 ]
> [ b b b b ]
> [ b j b b ]
> [ b b b b ]
> ]
>
> When trying to access an array element, the syntax is pretty convoluted.
> For example, I've been accessing x-y coordinates in the array like this:
>
> pick pick board-state y x
>
> I'm a neophyte with REBOL, so I don't doubt that there may be an easier way.
> What happened to C or Pascal's easy notation?
>
> board-state[x][y]
>
> Thanks,
> Carl
> --
> To unsubscribe from this list, please send an email to
> [rebol-request--rebol--com] with "unsubscribe" in the
> subject, without the quotes.
--
Ryan Cole
Programmer Analyst
www.iesco-dms.com
707-468-5400