What's an item ?

Alex Tweedly alex at tweedly.net
Mon Jul 19 21:26:27 CDT 2004


"What's an item?" seems like a pretty basic question.

And I  thought I knew the answer - until I spent some time this evening 
debugging what seemed like a trivial problem.

The essence of the problem can be described briefly:
   put the number of items in "a,b,c"   --> 3
   put the number of items in ",b,c"    --> 3    "a" replaced by empty
   put the number of items in "a,,c"    --> 3    "b" replaced by empty
   put the number of items in "a,b,"    --> 2   ******  "c" replaced by empty

why does "a,b," not represent 3 items - namely "a", and "b" and <empty> ?
or to put it another way - why is "a,b" equivalent to "a,b,"

I can get around it of course - but it's spoiling my mental concept of what 
an item is.

The dict just says "a string of chars delimited by a single comma (or 
itemDelim)", without mentioning the start and end cases.  It seemed that it 
could be re-written as " a string of chars delimited by start-of-string, 
comma or end-of-string" - but that doesn't account for the asymmetry. 
start-of-string to first comma is an item - even if it's empty
comma to end-of-string is an item ONLY if it's non-empty

Any clues for me on "how to think of an item" ?

Thanks
-- Alex.
-------------- next part --------------

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.719 / Virus Database: 475 - Release Date: 12/07/2004


More information about the use-livecode mailing list