Handbook
Glossary
cardinality ( set -- n )
Factor handbook
»
The language
»
Collections
»
Sets
»
Operations on sets
Prev:
members ( set -- seq )
Next:
adjoin ( elt set -- )
Vocabulary
sets
Inputs
set
a
set
Outputs
n
a non-negative integer
Word description
Returns the number of elements in the set. All sets support this operation.
Definition
IN:
sets
GENERIC:
cardinality
( set -- n )
Methods
USING:
accessors
bit-sets
math.bitwise
sets
;
M:
bit-set
cardinality
table>>
bit-count
;
USING:
kernel
sets
;
M:
f
cardinality
drop
0
;
USING:
accessors
hash-sets
kernel
math
sets
;
M:
hash-set
cardinality
[
count>>
]
[
deleted>>
]
bi
-
;
inline
USING:
accessors
assocs
linked-sets
sets
;
M:
linked-set
cardinality
assoc>>
assoc-size
;
USING:
accessors
ranges
sets
;
M:
range
cardinality
length>>
;
USING:
sequences
sets
;
M:
sequence
cardinality
fast-set
cardinality
;
USING:
sequences
sets
;
M:
set
cardinality
members
length
;
USING:
accessors
hash-sets.wrapped
sets
;
M:
wrapped-hash-set
cardinality
underlying>>
cardinality
;
inline