1. The length function

The manual indicates that, for example,

```length({{1,2}, {3,4}, {5,6}})   -- 3
```

but what should

```length({{}})
```

return?

The answer is 1, but why is it not 0?

2. Re: The length function

dr_can said...

The answer is 1, but why is it not 0?

Because that sequence contains one item: a sequence whose length is zero.

Here's another example:

```sequence item1 = {}
sequence item2 = {}
sequence item3 = {}

sequence items = { item1, item2, item3 }
? length( items ) -- contains 3 items
```

-Greg

3. Re: The length function

dr_can said...

The manual indicates that, for example,

```length({{1,2}, {3,4}, {5,6}})   -- 3
```

but what should

```length({{}})
```

return?

The answer is 1, but why is it not 0?

Consider

```sequence s1 = {}
sequence s2 = {s1}

? length(s2) -- returns 1
? length(s1) -- returns 0
```

Now, s2 is a sequence and s2[1] is s1. It is not empty in itself. The sequence s1 is empty however. Finally s2 is equivalent to

```{{}}
```

SD Pringle