Re: Quickest way to find out if a sequence is/isn't empty?
- Posted by ArthurCrump Oct 14, 2013
- 1386 views
jimcbrown said...
length(mySequence) is the fastest. length() doesn't count the elements, it just references the existing count (so it's like accessing mySequence[0] where mySequence[0] is always an integer).
This can be extended to general objects; if you want to know whether an object is an empty sequence.
The manual states that the length of an atom is always 1, so:
length(myObject) is zero only when myObject is an empty sequence.
Arthur