Hello Joel,

Hope you're over your flu by now. I am truly amazed that anyone can write
such a coherent and ground-breaking essay under such conditions!

I've read your essay, and think the model will be very useful. Overall I
believe it is accurate, and it is also reasonably easy to understand.

I have a lot of comments to make, so I think I'll split them up into two
messages. In the first post (this one) I'll comment on the diagrams, and in
the second one I'll make some miscellaneous comments on your explanations.

I'll try to copy your usage of series and sequence, although it's likely that
I'll fall out of it somewhere along the line. Please forgive me if I do. I
still prefer to use the term series in an ambiguous sense, with disambiguation
wherever necessary through such expressions as "series value" to mean series
in your strict sense, and "series itself" or "underlying series" to mean
what you call a sequence. However, in describing series with the detail and
rigor you are attempting, I recognise that your unambiguous terms can be very
useful.

1. We need to stress the uniqueness of series values more.

>From essay/2

>The translation of the REBOL expression:
>
>    [10 "1234" 11]
>
>could be described by the picture (not REBOL notation!):
>
>    {{block! 1 *}}
>               |
>               V
>               <<10 * 12>>
>                    |
>                    V
>                    {{string! 1 *}}
>                                |
>                                V
>                                <<#"1" #"2" #"3" #"4">>

You say that asterisks plus arrows denote references. I wonder if it might
not be more accurate to say:

    {{block! 1 *}}
               |
               V
               <<10 {{string! 1 *}} 12>>
                                |
                                V
                                <<#"1" #"2" #"3" #"4">>

At least in my mental picture of blocks, series values are directly embedded
within blocks, rather than being referenced. That might well be inaccurate
somewhere within the implementation level, but on the model level I think
your picture may be confusing. For example, in your next diagram:

>    a -> {{string! 1 *}}
>         ^           |
>         |           V
>    b ---+           <<#"1" #"2" #"3" #"4">>

I think there's an error. 'a and 'b are bound to different (but identical)
series values, although the underlying sequence is of course the same. I
think it would be better to represent this situation as:

    a -> {{string! 1 *}}
                     |
                     V
                     <<#"1" #"2" #"3" #"4">>
                     ^
                     |
    b -> {{string! 1 *}}

This revised diagram is very similar to one in essay/3:

>    a -> {{string! 1 *}}
>                     |
>                     V
>                     <<#"1" #"2" #"3" #"4">>
>                     ^
>                     |
>    b -> {{string! 2 *}}

Also, in essay/4 you have:

>After the last diagram above, evaluating:
>
>    r: append b "X"
>
>produces the following state:
>
>    a ---> {{string! 1 *}}
>                       |
>                       V
>                       <<#"1" #"2" #"3" #"4">>
>                       ^
>                      / \
>                     /   \
>    b -> {{string! 2 *}}  \
>                           \
>    r -------> {{string! 1 *}}

which I wouldn't quarrel with. Just as I've said before, the value of 'r is
a different but identical instance of the value of 'a.

(I assume you meant to represent the sequence as <<#"1" #"2" #"3" #"4" #"X">>)

To flog this idea a little more, what would you do with a simple case of
integers:

a: 5
b: a

? Does this give you:

     a -> 5
          ^
          |
     b ---+

or:

     a -> 5
     b -> 5

? Obviously the latter picture is more accurate, since there's nothing you
can do to 'b now to change the value that 'a is bound to. Further there is no
way you can ask 'a or 'b whether there is another word bound to the same
value.

So, in the same way, after:

a: "1234"
b: a

the only way to change the value 'a is bound to is by changing the underlying
sequence - you cannot change the basic information in the value of 'a -
neither __which__ sequence is referenced, nor the index. Your diagrams seem
to leave that possibility open.

NOTE: Please see my PS on lists.


2. We should graphically show the difference between binding and reference.

As I understand it, the relationship between words and the values they are
bound to, and the relationship between series values and the sequences they
refer to are entirely different. One really should use a different form of
arrow for these two, although that would be difficult with the ASCII lower
128!


3. Sequences are typed, too.

Your diagrams seem to leave open the possibility of this kind of situation:

    a -> {{string! 1 *}}
                     |
                     V
                     <<#"1" #"2" #"3" #"4">>
                     ^
                     |
    b --> {{email! 1 *}}

which is of course impossible. Perhaps:

    a -> {{* 1}}
           |
           V
           <<string! | #"1" #"2" #"3" #"4">>

would be better.


4. Couldn't indexes be portrayed graphically?

Your diagrams represent the index of a series value numerically, and the
arrows that emanate from the * always point to the << >> shell around the
representation of the sequence. That is perhaps ideal for the rigorous
approach that you are taking, but wouldn't it be more helpful, for beginners
trying to develop a mental picture of what's going on, to have the reference
arrow pointing directly to the element at the indexed position?

For example, one of the diagrams quoted above could be represented as:

           a -> {{* 1}}
                  |
                  V
      <<string! | #"1" #"2" #"3" #"4">>
                       ^
                       |
                b -> {{* 2}}

This has the advantage of showing us immediately where INSERT will operate.
So if we do:

      insert a "XYZ"

we get:

           a -> {{* 1}}
                  |
                  V
      <<string! | #"X" #"Y" #"Z" #"1" #"2" #"3" #"4">>
                       ^
                       |
                b -> {{* 2}}

I'm sure you must have considered this possibility and rejected it, but I
do think it's more helpful for learning how to visualize series, and I don't
see that there's any great harm in it. Of course it's redundant to represent
the index numerically and graphically, but if that's a problem I'd prefer to
ditch the numerical representation. After all, when you evaluate 'a you see
the series, but you have to use a function to get the index. Perhaps the
index is more fundamental in some ways, but I think a representation closer
to what you experience when actually using REBOL is better.

See you soon,
Eric


-*-*-*-*-*-*-*-

PS I'm starting to enjoy playing around with your diagrams! Let me see what
I can do with one from essay/5:

>    a: "1234"
>    x: [a: "987"]
[snip]
>    do x
>
>the situation is different (and fairly distinctive to REBOL):
>
>    a -------------------------+
>                               |
>                               |
>    x -> {{block! 1 *}}        |
>                    |          /
>                    V         /
>                    <<a: *>> /
>                          \ /
>                           V
>                           {{string! 1 *}}
>                                       |
>                                       V
>                                       <<#"9" #"8" #"7">>

This is what I'd like to do (with a double-lined arrow for binding):

    a ===============================> {{* 1}}
                                         |
    x ------------------> {{* 1}}        |
                            |            |
                            V            |
                 <<block! | a: {{* 1}}>> |
                                  \      |
                                   \     |
                                    \    |
                                     \   |
                                      \  |
                                       \ |
                                        \|
                                         V
                             <<string! | #"9" #"8" #"7">>

Actually, I'm still leaving something out, which can be demonstrated as
follows:

>> x: [a: "987"]
== [a: "987"]
>> do x
== "987"
>> get x/1
== "987"
>> x/1
== a:

The set-word a: has the same binding as the word a, so we really should also
draw =====> from the first element of the sequence <<block! | a: {{* 1}}>>
to the value {{* 1}} in the upper right corner. (In this case a and a: really
are bound to the same instance of the series value.)


Let me do just one more!

In your diagram in essay/6 following:

a: [1 "st" 2 "nd"]
b: a
c: copy a
append b [3 "rd"]
insert a/2 a/1
insert a/4 a/3

you forgot to show the effects of the two inserts. Anyway, this is how I'd
show the situation:

    a ====> {{* 1}}   {{* 1}} <===== b
              |        /
              |  ------
              | /
              |/
              V
   <<block! | 1 {{* 1}} 2 {{* 1}} 3 {{* 1}}>
                  |          \         \
                  |           \         --------------------
                  |            -------------                \
                 /                          \                V
                /                            \   <<string! | #"r" #"d">>
               V                              V
   <<string! | #"1" #"s" #"t">>   <<string! | #"2" #"n" #"d">>
               ^                              ^
                \                            /
                 \            ---------------
                  |          /
   <<block! | 1 {{* 1}} 2 {{* 1}}>
              ^
              |
    c ====> {{* 1}}


PS on lists (as promised):

The behavior of lists is different from all other series!!!!

>> a: skip make list! [1 2 3 4 5] 2
== make list! [3 4 5]
>> b: head a
== make list! [1 2 3 4 5]
>> index? a
== 3
>> insert b [9 8 7]
== make list! [1 2 3 4 5]
>> index? a
== 6

A list value doesn't include a numerical index; it includes a "direct"
reference to an element in the list sequence, so that the numerical index of
a list value may change. There are further surprises:

>> index? b
== 4                        ; The index of the value of 'b changed too!
>> remove skip b 2
== make list! [4 5]
>> a
== make list! []
>> index? a
** Script Error: Out of range or past end.
** Where: index? a
>> back a
** Script Error: Out of range or past end.
** Where: back a
>> tail? a
** Script Error: Out of range or past end.
** Where: tail? a
>> head a
== make list! [9 8 7 1 2 4 5]

The element referenced through the value of 'a disappeared, so apparently 'a
only references the list sequence, and has no valid index value.

End of PS on lists, end of post. Please read part 2!
Bye!

Reply via email to