• Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

World: r4wp

[#Red] Red language group

Andreas
15-Nov-2012
[3560]
... when having to compute indices with integers*
Ladislav
15-Nov-2012
[3561]
Numbering positions in a series is, in other words, characterized 
as "mathematically modelling 'positions' in a series". Your "inbetween 
positions" are something that does not exist in the series in fact.
Andreas
15-Nov-2012
[3562]
Even if you talk about "inbetween", there is _no_ integer in between 
1 and 2, but there is an integer between -1 and 1.
DocKimbel
15-Nov-2012
[3563]
Tail position is inbetween, underlying implementation details cannot 
change that fact.
Ladislav
15-Nov-2012
[3564x2]
Tail position is inbetween - actually not. You can write: INSERT 
TAIL SERIES #"a". You do not insert the character "inbetween", in 
fact.
Also, the SKIP function demonstrates the same behaviour quite well 
and consistently.
Andreas
15-Nov-2012
[3566]
tail position

 is actually a misnomer, in as far as it corresponds to no proper 
 index of a series. The special behaviour series seen in some functions 
 when operating on series in "tail position" would warrant "tail mode" 
 as a more sensible description of the state the series is in.
Ladislav
15-Nov-2012
[3567]
as it corresponds to no proper index of a series

 - I reserve the right to disagree. INDEX? TAIL gives some correspondence
Andreas
15-Nov-2012
[3568]
Yes, it gives an index that can I'd consider "improper" for the series, 
in as far as the series does not contain a value at that position.
Ladislav
15-Nov-2012
[3569]
that is arguable, while the INDEX? TAIL is not arguable, giving actual 
correspondence
Andreas
15-Nov-2012
[3570]
A rather meaningless correspondence, though.
DocKimbel
15-Nov-2012
[3571]
Subjective interpretations of series tail position are possible, 
as TAIL position exists without pointing to any value.
Andreas
15-Nov-2012
[3572]
(And an index that does not correspond to a value in the series, 
at this point in time.)
Ladislav
15-Nov-2012
[3573x2]
It is not meaningless as far as I am concerned. Reson: it would be 
meaningless only if you agreed that INDEX? should not yield a value 
for TAIL
Actually, I can demonstrate that even past-tail indices are meaningful 
for blocks, and I did.
Andreas
15-Nov-2012
[3575]
Actually, what I was trying to say is that the discussion of "tail 
position" unnecessarily clouds the discussion.
DocKimbel
15-Nov-2012
[3576]
http://www.rebol.com/r3/docs/concepts/series-traversing.html


The first position of the block is called its head. This is the position 
occupied by the word red. The last position of the block is called 
its tail. This is the position immediately after the last word in 
the block. If you were to draw a diagram of the block, it would look 
like this: [...] Notice that the tail is just past the end of the 
block.

Too bad the images are missing...
Ladislav
15-Nov-2012
[3577x2]
Well, that is arguable....
(I meant that as a reaction to Andreas' contrib above)
Andreas
15-Nov-2012
[3579x2]
Yes, that's certainly arguable. I say that because I think that "head 
position" and "tail position" sound like dual concepts, whereas they 
are not.
Image is here:
http://www.rebol.com/docs/core23/rebolcore-6.html#section-1.1
Ladislav
15-Nov-2012
[3581]
The first position of the block is called its head.
 - that is actually false
DocKimbel
15-Nov-2012
[3582]
Hasn't Carl wrote that? :-)
Ladislav
15-Nov-2012
[3583x4]
(It would be true only if we defined "the first position" to be compatible 
with the sentence)
Or, in a special case.
(like one example...)
Frankly, I do not care who wrote what.
Andreas
15-Nov-2012
[3587]
Hehe. Note that it's "the first position" with plain english first, 
not "the <tt>first</tt> position" with first as reference to the 
FIRST native.
Ladislav
15-Nov-2012
[3588]
the first position of the block is called its head

 is true if we define "the first position is the position with INDEX? 
 = 1"
Andreas
15-Nov-2012
[3589x2]
Yes.
Which differs from the notion used by FIRST.
Ladislav
15-Nov-2012
[3591x2]
which is what I meant by "It would be true if we defined..."
To be clear we should write "the position of the block with INDEX? 
= 1 is called its head"
Andreas
15-Nov-2012
[3593]
Or we should come up with better nomenclature :)
Ladislav
15-Nov-2012
[3594]
Any other consistent nomenclature would do as well.
Arnold
15-Nov-2012
[3595]
>> head? []          
== true
>> tail? []
== true
>> first []
** Script Error: Out of range or past end
** Where: halt-view
** Near: first []
Andreas
15-Nov-2012
[3596x3]
Do you consider R2's nomenclature to be particularly consistent and 
simple?
I think you (Ladislav) generally reduce R2's nomenclature to an offset-based 
interpretation?
(i.e. "SKIP-based")
DocKimbel
15-Nov-2012
[3599]
Which differs from the notion used by FIRST.
 You lost me there...how so?
Andreas
15-Nov-2012
[3600]
The first position of the block is called its head

 is only true if we define "the first position" as the position with 
 INDEX? = 1.


FIRST, on the other hand, does not follow this "the first position" 
interpretation, but rather gives the value at the current position, 
where current position is the value returned by INDEX?.
Ladislav
15-Nov-2012
[3601]
I do not, I am just sure that the nomenclature discussed above *is 
inconsistent*
Andreas
15-Nov-2012
[3602x2]
In effect, we have to different notions of "first position": one 
used in HEAD, one used in FIRST.
two* different notions
Ladislav
15-Nov-2012
[3604]
also, yet another inconsistency (PICK help string):

Returns the value at the specified position in a series.
DocKimbel
15-Nov-2012
[3605]
Andreas: right.
Ladislav
15-Nov-2012
[3606x3]
In this case, PICK is consistent with FIRST, but not with "the first 
position of the block is called its head"
In the light of these, taking the INDEX? help string we may actually 
say that the formulation:

Returns the index number of the current position in the series.

is actually indefinite, not determining anything at all
(or not explaining anything at all)
Andreas
15-Nov-2012
[3609]
My thought behind the "tail position" complaint above was, that series, 
position, and index are already used rather exchangably, and lax 
in a few parts of REBOL's documentation. Adding "tail position" to 
the mix, only further contributes to that confusion.