Handbook
Glossary
all-unique? ( set -- ? )
Factor handbook
»
The language
»
Collections
»
Sets
»
Operations on sets
Prev:
fast-set ( set -- set' )
Next:
duplicates ( set -- seq )
Vocabulary
sets
Inputs
set
a
set
Outputs
?
a
boolean
Word description
Tests whether a set contains any repeated elements.
USING: sets prettyprint ; { 0 1 1 2 3 5 } all-unique? .
f
Definition
IN:
sets
GENERIC:
all-unique?
( set -- ? )
Methods
USING:
kernel
ranges
sets
;
M:
range
all-unique?
drop
t
;
USING:
hash-sets
kernel
sequences
sets
;
M:
sequence
all-unique?
dup
length
<hash-set>
[
?adjoin
]
curry
all?
;
USING:
kernel
sets
;
M:
set
all-unique?
drop
t
;