Re: The length function
- Posted by SDPringle May 06, 2016
- 1242 views
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