Keith, 

The position past the insert is returned, but INSERT does not change the "cursor" of 
the original variable. So, to get the result you expected, you could write 

TEXT: "is now"
TEXT: INSERT TEXT "the "
TEXT: INSERT TEXT "time "
TEXT: HEAD TEXT

and the result is "the time is now". 

So, INSERT (and APPEND) act just like HEAD. You can assign the result to the same 
variable, and thereby move the cursor of the original, or assign it to some other 
variable, and use that pointer instead. 

Here's a related example of how the series work:

>>TEXT: "is now"
== "is now"
TEXT-2: INSERT TEXT "The time " ;-- Assigning result to TEXT-2
== "The time is now"
APPEND TEXT-2 "!!!" ;-- Appending exclamation point to TEXT-2
== "The time is now!!!"
TEXT: HEAD TEXT ;-- Returns same value as TEXT-2
== "The time is now!!!"

So, after assigning the result to TEXT-2, and making some changes to TEXT-2, the 
changes are also reflected under the original text variable. This is because the 
series-block has it's own identity, TEXT and TEXT-2 are only pointers to the block. If 
I wanted TEXT and TEXT-2 to be seperate values, I would have to COPY the block.

*********** REPLY SEPARATOR  ***********

On 12/6/1999 at 5:52 PM [EMAIL PROTECTED] wrote:

Hi, I'm not sure if insert works how it's supposed to.

This is from the dictionary:

If the value is a series compatible with the first (block or string-based
datatype), then all of its values will be inserted. The series position just
past the insert is returned, allowing multiple inserts to be cascaded
together.

I would think that if I said:

text: "is now"
insert text "the "
insert text "time "
text: head text

I should get "the time is now" but I get "time the is now"

Shouldn't it insert the "the " at the beginning, but then leave me "just
past the insert" so that if I say insert again it inserts it after the "the
"? This is what I would think it meant by cascading inserts together. If you
say:

duh: ""
insert duh "The "
insert duh "time "
insert duh "is "
insert duh "now. "
duh: head duh

I would expect to get "The time is now.", but I get "now. is time The ".

What do you think?

Keith



Reply via email to