lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


On Jun 16, 2011 12:29 AM, "Lorenzo Donati" <lorenzodonatibz@interfree.it> wrote:
>
> On 16/06/2011 7.02, Lorenzo Donati wrote:
>>
>> On 16/06/2011 3.48, David Manura wrote:
>>>
>>> On Wed, Jun 15, 2011 at 9:42 PM, Xavier Wang<weasley.wx@gmail.com> wrote:
>>>>>
>>>>> The length of a table t is only defined if the table is a sequence,
>>>>> that is,
>>>>> all its numeric keys comprise the set {1..n} for some integer n.
>>>>
>>>> is that mean, a empty table ({}) has no length defined?
>>>
>>>
>>> Maybe say "non-negative integer n". IMO, {1..0} == {}.
>>>
>>>
>>>
>>
>> Maybe it's because I'm not a native english speaker but I find the
>> wording " ... all its numeric keys comprise the set {1..n} for some
>> integer n." a little ambiguous.
>>
>> The point here is the verb "to comprise". According to Oxford Advanced
>> Learner's Dictionary it may have these two complementary meanings:
>>
>> "(a) to have sb/sth as parts or members; to be composed of sb/sth"
>>
>> "(b) to be the parts or members that form sth"
>>
>> It warns that (b) is less used, but since here we are talking about
>> computer language specifications that will be read by people all around
>> the world, with different education, mother language and computer
>> skills, maybe it would be good to change that verb.
>>
>>
>> I double checked with Webster's New World Dictionary and it gives three
>> meaning:
>>
>> 1. to include; to contain
>> 2. to consists of; to be composed of
>> 3. to make up; to form
>>
>> as a synonym cites "include", so the actual wording might be really
>> ambiguous if one gets it wrong.
>>
>> I suggest rewriting it as:
>>
>>
>> " ... all its numeric keys consists of the set {1..n} for some integer n."
>>
>> but a native English speaker is very welcome to give a better suggestion!
>>
>>
>> -- Lorenzo
>>
>>
>>
> Maybe a simple paragraph with a more mathematical definition could be better:
>
> "A table is called a sequence if there exists a non-negative integer n such that the set of its numeric keys is {1...n}. In this case n is defined as the length of the sequence. An empty table {} or a table with no numeric keys is considered a sequence of length 0."
>
>
>

Does that mean a table having keys 0, -1 or 1.5 no longer has a defined length?