Inconsistent Behavior of Lists

J. Landman Gay jacque at
Wed Sep 15 23:40:45 EDT 2004

On 9/15/04 7:27 PM, Dan Shafer wrote:

> A list should be seen as a comma-delimited data container where commas 
> separate data elements. Spaces after commas should not be significant. 
> They aren't in any other language I know of that processes list data 
> structures. 

Except in other xtalk languages, including HyperCard where the custom 
started.  ;)

"Items" are everything in between commas (or whatever the current 
delimiter is.) That includes carriage returns too. This string has two 

   dog, cat

The second item starts with a space and includes a carriage return in 
the middle.

I know you already know about "words," but for any newcomers: The same 
convention is true of words. A word is everything between white space 
("white space" can be a space, tab, or carriage return.) This contains 
one word:


This contains three words, with the first two on line 1:

   my big,fat

There is one single exception to the definition of a word: any literal 
within double quotation marks is a single word. This has two words:

   my "big fat cat ate my little bird"

There is a historical reason for this last thing, which started back in 
the early HyperCard days. This definition of a "word" was convenient 
because it allowed developers to get the value of a file name in a 
single statement. In HyperCard, the "filename" property does not exist, 
so a script must parse the long name of a stack instead. The long name 
is the word "stack" followed by the filename in quotes. To get the 
actual file name in HyperCard, one routinely does this:

   put word 2 of the long name of this stack into theFilePath

Maybe that's than anyone wanted to know. ;)

Jacqueline Landman Gay         |     jacque at
HyperActive Software           |

More information about the use-livecode mailing list