[REBOL] Re: Correct Behaviour? Was False = 2 ????
From: robbo1mark:aol at: 4-Jul-2001 14:31
Hello Jeff,
>zeroth: func [x][pick x 0]
>first: :second
>second: :third
>third: :fourth
>fourth: :fifth
This part of what you wrote is surely wrong?
As we discussed earlier about the series of natural numbers 0 1 2 3 4 5 ...... infinity
0 is the FIRST number there is no ZEROTH, 1 is the second number.
The functionality of FIRST, SECOND etc need not change.
First would still pick the FIRST element of a series at
index position zero. SECOND would pick second element of series at index 1.
Repeat after me "Counting is NOT the same as indexing..."
Yes it would require an audit of mezzanine code to change / modify affected code and
YOU guys would have to amend the native! code but just because it is NOT a cost free
task does not mean it is not the "right" thing to do IMHO.
Do we stick with the "wrong" way forever just because it is too daunting / too much work
to change now?
Admittedly "right" and "wrong" are MY subjective opinions on this matter, as well as
some other peoples,
but that doesn't alter the principle that should you forego the opportunity to DO something
differently or better just because of the work involved?
However, if you want and I will gladly audit all REBOL mezzanine code and make the necessary
changes if you give me sufficient time / incentive / advice.
What do you say? will RT Inc take me up on my offer?
cheers,
Mark Dickson
In a message dated Wed, 4 Jul 2001 2:11:34 PM Eastern Daylight Time, Jeff Kreis <[jeff--rebol--net]>
writes:
<<
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