The MID$ function returns part of a string (a substring).
The MID$ statement replaces part of a string variable with another string.
MID$(stringexpression$,start%[,length%])
MID$(stringvariable$,start%[,length%])=stringexpression$
* stringexpression$ The string from which the MID$ function returns
a substring, or the replacement string used by the
MID$ statement. It can be any string expression.
* start% The position of the first character in the
substring being returned or replaced.
* length% The number of characters in the substring. If the
length is omitted, MID$ returns or replaces all
characters to the right of the start position.
* stringvariable$ The string variable being modified by the MID$
statement.
Example:
a$ = "Where is Paris?"
PRINT MID$(a$, 10, 5) 'Output is: Paris
Text$ = "Paris, France"
PRINT Text$ 'Output is: Paris, France
MID$(Text$, 8) = "Texas "
PRINT Text$ 'Output is: Paris, Texas
I think a better name could be setChunk or setString (since we already use "string" terminology in "substringp").
in python it is called "list slice assignment"
and Comenius Logo and Imagine Logo
http://groups.yahoo.com/group/LogoForum/message/15021
In Logo, words (which is what other languages calls "strings") are immutable, so they cannot be modified in-place. The second form of MID$ would have to be implemented by creating a new word that is the concatenation of the first part of the word with the last part of the word.
Another problem is that I cannot add a new primitive for this without breaking backward-compatibility with programs that may define a command with the same name. Adding it as a LogoLib routine would be safe, but anyone can do that (you don't need to recompile Logo to write library routines).
If performance is a concern, then I could extend FIRST, LAST, and ITEM so that they output the N elements, instead of 1. (FIRST and LAST would take an additional parameter, and ITEM would optionally take a two-member list, instead of an index). That said, I'd be surprised if anyone using FMSLogo is concerned about performance, so a library routine is probably sufficient.