Hi all -
This thread reminds me of some of the
very nice MATLAB notation for referencing
matrix or array elements:
A(1:10) - elements 1 thru 10
A(:,5:10) - all rows, only columns 5 thru 10
A(5:10,:) - all columns, only rows 5 thru 10
A(:) - all elements
A' - all elements transposed (cols switched
with rows) dimension r x c becomes c x r
It might be nice to accommodate the two dimensional
idea as an enhancement; n-dimensional referencing
might be nice too...
A REBOL shorthand for block or series referencing
in this flavor might be very helpful -- at least
I think it would. On the other hand, I've got a
long way to go before I appreciate the subtleties
of REBOL ...
Mike
<SNIP>
>
> now you're talking
>
> it even looks rebolish... add python's list notation which
> is nice (I must admit, and is missing altogether in rebol).
>
> examples (with equivalent rebol line after):
>
> series[5:10] -> return a series starting at 5 ending at 10
> copy/part at series 5 at series 10
>
> series[5] -> return element 5
> series/5 (I'd rather keep series/5 and add /[5] which
> returns a block with only the fifth element in it
>
> series[:10] -> return everything up to element 10
> copy/part series at series 10
>
> series[5:] -> return everything starting a element 5
> at series 5
>
>
> you can even use negative indexes to reverse the direction...
>
> so:
> series[-5:-10]
> reverse at series (length? series - 10) at series (length?
> series - 5)
>
>
> the advantage of the python notation is that it is much more
> unified. It is also often much shorter and more visual
>
> I'm not saying scrap the current system (we needs its
> versatility and oppeness), just adding some equivalent to
> the python method in the way Carl just wrote it. We'd all
> benefit from shorter, often, more redeable scripts.
>
>
> I know we can write a function for it... but that adds a
> word in the source which really isn't needed if its
> supported in the base syntax. Only RT can do that.
>
>
> the way carl just describes it, added with added range
> notation does not break any current rebol syntax I can
> remember, yet it makes our lives much simpler.
>
> What do you all think?
>
>
> -MAx
>
>
>
> --
> To unsubscribe from this list, just send an email to
> [EMAIL PROTECTED] with unsubscribe as the subject.
>
--
To unsubscribe from this list, just send an email to
[EMAIL PROTECTED] with unsubscribe as the subject.