1.2.3-SNAPSHOT Arrow_down_16x16

length

incanter.core

  • (length coll)
A version of count that works on collections, matrices, and numbers.
The length of a number is one, the length of a collection is its count
and the length of a matrix is the number of elements it contains (nrow*ncol).
Equivalent to R's length function.

0 Examples top

Log in to add / edit an example.

See Also top

Log in to add a see also.

Plus_12x12 Minus_12x12 Source incanter/core.clj:1057 top

(defn length
  " A version of count that works on collections, matrices, and numbers.
    The length of a number is one, the length of a collection is its count
    and the length of a matrix is the number of elements it contains (nrow*ncol).
    Equivalent to R's length function.
  "
  ([coll]
    (cond
      (number? coll)
        1
      (matrix? coll)
        (* (.rows ^Matrix coll) (.columns ^Matrix coll))
      (coll? coll)
        (count coll)
      :else
        1)))
Vars in incanter.core/length: * coll? cond count defn number?
Used in 0 other vars

Comments top

No comments for length. Log in to add a comment.