[REBOL] Re: Correct Behaviour? Was False = 2 ????
From: jeff:rebol at: 4-Jul-2001 11:05
So... let's give it a try..
pick': :pick
pick: func [series index][pick' series index + 1]
index?': :index?
index?: func [series][(index?' series) - 1]
at': :at
at: func [series index][at' series index + 1]
zeroth: func [x][pick x 0]
first: :second
second: :third
third: :fourth
fourth: :fifth
fifth: func [x][pick x 5]
zeroth [1 2 3 4 5]
== 1
first [1 2 3 4 5]
== 2
pick [1 2 3] 0
== 1
fifth [1 2 3 4 5 6]
== 6
zeroth second [[A B C][9 8 7][1 2 3]]
== 1
index? "abc"
== 0
at "1234" 3
== "4"
;-------------------------------------------
The only problem with all this is you have to go and change
all occurances of first, second, third, etc. through out the
rest of REBOL to reflect the new index.
>> ? help
** Script Error: third expected series argument of type: series money date port tuple
event
** Where: ?
** Near: args: third :value
prin "USAGE:^/^-"
>>
Maybe some ambitious zero-based indexer would like to create
a script that goes through and changes all occurrences of the
numbered pickers in the REBOL mezzanine layer. Then all that's
left is to figure out some way to change the path pickers.
I'll contemplate that zero zeroth thing tomorrow morning.
We might need an additional NEEDS field:
REBOL [
Title: "My mostly portable script"
Needs: [zero-indexing]
]
:-) REBOL is the zeroth language of its kind! All for zero
and zero for all! And for those here in the US, happy third
of July! (-:
-jeff