len -package:fixed-vector-hetero
only for byte arrays. This is a JS byte array method
Coding list-length recursively. Again, we map directly to an SMTLib
function.
O(1). Returns the length of a structure as an
Int. On
infinite lists returns the
Ints
maxBound.
>>> len $ one 42
1
>>> len $ slist [1..3]
3
>>> len $ infiniteSlist [1..]
9223372036854775807
the length (#) operation. If the object is not a string, Lua
will try its metamethod. If there is a metamethod, Lua calls it with
the object as argument, and the result of the call (always adjusted to
one value) is the result of the operation. If there is no metamethod
but the object is a table, then Lua uses the table length operation
(see §3.4.7). Otherwise, Lua raises an error.
Returns the size/length of a finite structure as an
Int. The
default implementation just counts elements starting with the
leftmost. Instances for structures that can compute the element count
faster than via element-by-element counting, should provide a
specialised implementation.
Examples
Basic usage:
>>> length []
0
>>> length ['a', 'b', 'c']
3
>>> length [1..]
* Hangs forever *
Return the number of elements in an array, excluding the terminator
length returns the length of a finite list as an
Int. It is an instance of the more general
genericLength, the result type of which may be any kind of
number.
>>> length []
0
>>> length ['a', 'b', 'c']
3
>>> length [1..]
* Hangs forever *
O(1) length returns the length of a ByteString as an
Int.
O(c) length returns the length of a ByteString as an
Int64
O(n) Returns the number of characters in a
Text.