World: r4wp
[#Red] Red language group
older newer | first last |
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 [3609x2] | 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. |
As "tail position" severely weakens the definition possibilities for "position". | |
Ladislav 15-Nov-2012 [3611] | Yes, the nomenclature problem... |
Maxim 15-Nov-2012 [3612] | If you realize that indices are one degree vectors. A lot of this discussion becomes moot. vectors of length 0 are considered impossible when considering only natural numbers (due to 0 divide). This is why I consider R2's handling of indices proper. As such, any series "position" is not AT a value it is LOOKING AT a value (oriented in positive direction, starting at a point in space which is "0"). like extending your arm to grasp the nth thing in front of you. Tail are 0 length vectors (thus mathematically imposible), when we are beyond the last item edge we are at the edge of space. you cannot "take" the tail item, there is nothin in front of you, just as you cannot "take" the 0th item, there is no such thing, 0 is the origin of the vector). when we consider series indices to be vectors, we see the natural relationship which Ladislav pointed with SKIP and other methods. with vectors, things like COPY/PART make sense in the negative direction, just as well as in the positive direction. In R3, this was changed to indices being OVER a value , with the first item requiring you to look down and then away for other values. The issue is that index 0 is looking backwards... that doesn' map to any good reasoning. In fact it creates many weird inconsitencies in the model, when you try to describe it. R3's series changes seem like a kludge work-around to map non-vectorial infinite integer space to a bounded vectorial space. sacrificing model integrity in the process (while trying to ease its mathematical properties). R3's series *may* be "easier to count in a loop" but the values being used make no sense. counting backwards requires us to manipulate the indice for it to "make sense", whereas before, counting backwards was the same as counting forward. we where just LOOKING in the opposite direction (the vector's orientation is inversed). |
Ladislav 15-Nov-2012 [3613x2] | Moreover, something like "the head position" is actually a "permanent characteristic", while "the tail position" is in a sense "ephemeral" as demonstrated by the following: block: [a b c] pos-a: head block pos-b: next pos-a pos-c: next pos-b ; now, POS-C is not tail tail? POS-C ; == false remove back tail block tail? POS-C; == true append block 'c tail? pos-c ; false again |
, while the POS-C is not ephemeral, continuing to exist no matter what | |
Andreas 15-Nov-2012 [3615] | Maxim, unfortunately this does not help at all, because we have no built-in way to compute with those vectors. |
Maxim 15-Nov-2012 [3616] | exactly. we don't have an index! type. |
Ladislav 15-Nov-2012 [3617x2] | My note to Max's contribution: - in REBOL, blocks of length 0 are not "impossible", that is, we have to use a nomenclature compatible with this fact |
The issue is that index 0 is looking backwards... that doesn' map to any good reasoning. In fact it creates many weird inconsitencies in the model, when you try to describe it. - it may not be a "weird inconsistency", but it is almost imposible to describe to a newbie in a reasonable way | |
Maxim 15-Nov-2012 [3619] | empty blocks are not impossible to describe. but all functions will provide special cases to manage them (return another infinitely small block or none, or raise an error) because as such, they are vectorially equivalent to null. an empty block is just a starting place without any room to move. when only looking forward, it is exactly the same as the tail (when you read my original post) and hence in actual code, tail [1 2 3] and [ ] are exactly the same, if only positive indices are being used. |
Andreas 15-Nov-2012 [3620x3] | Too many constraints. |
REBOL allows you to look backwards, REBOL allows you to use negative indices. | |
As such R3's model is actually not only _not_ "weirdly inconsistent", but actually more consistent than R2's model, when having to use in-language properties to describe it. | |
older newer | first last |