Re: Quickest way to find out if a sequence is/isn't empty?

new topic     » goto parent     » topic index » view thread      » older message » newer message
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

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu