Handbook
Glossary
duplicates ( set -- seq )
Factor handbook
»
The language
»
Collections
»
Sets
»
Operations on sets
Prev:
all-unique? ( set -- ? )
Next:
within ( seq set -- subseq )
Vocabulary
sets
Inputs
set
a
set
Outputs
seq
a
sequence
Word description
Outputs a sequence consisting of elements which occur more than once in
set
.
Examples
USING: sets prettyprint ; { 1 2 3 1 2 1 } duplicates .
{ 1 2 1 }
Definition
IN:
sets
GENERIC:
duplicates
( set -- seq )
Methods
USING:
kernel
ranges
sets
;
M:
range
duplicates
drop
f
;
USING:
hash-sets
kernel
sequences
sets
;
M:
sequence
duplicates
dup
length
<hash-set>
[
?adjoin
]
curry
reject
;
USING:
kernel
sets
;
M:
set
duplicates
drop
f
;