[REBOL] Re: Array access and paths
From: cyphre:volny:cz at: 18-May-2001 17:00
> I think this is the single most annoying thing about REBOL.
> Dealing with matrices etc is a nightmare!!
>
I don't think so. Have a look at REBOLek's rebsite %matrix.r script... realy
nice and fast vector graphics example using matrices!
> Here is an example:
>
> list: [A 0 B 5 C 0 D 0]
>
> Say I want to change the number 5 following the B to 6.
> It's easy to read this number:
>
> >> list/B
> == 5
>
> Or more generally:
>
> >> idx: 'B
> == B
> >> list/:idx
> == 5
>
> So far it looks very good.
> But then, try changing this value!
>
> >> change at list 'B 6
>
> does not work.
'at needs as a second parameter index not word...
you can try this:
change at list index? next find list 'b 6
or
poke list index? next find list 'b 6
but I'd prefer your solution above...
> >> change next find list 'B 6
>
> Not very nice.
>
> Another example:
>
> I want to get a function from an array:
>
> >> func-array: reduce [a: func [x][]]
> == [func [x][]]
> >> f: :func-array/1
> ** Script Error: 1 is missing its x argument
> ** Near: f: :func-array/1
>
try:
probe pick :func-array 1
or
probe first :func-array
have fun,
Cyphre