hash-sets: fix help-lint warnings.
parent
895c6ca7c5
commit
931b5cc9bd
|
@ -2,7 +2,7 @@ USING: help.markup help.syntax math sequences ;
|
||||||
IN: hash-sets
|
IN: hash-sets
|
||||||
|
|
||||||
ARTICLE: "hash-sets" "Hash sets"
|
ARTICLE: "hash-sets" "Hash sets"
|
||||||
"The " { $vocab-link "hash-sets" } " vocabulary implements hashtable-backed sets. Hash sets form a class:"
|
"The " { $vocab-link "hash-sets" } " vocabulary implements hashtable-like sets. Hash sets form a class:"
|
||||||
{ $subsections hash-set }
|
{ $subsections hash-set }
|
||||||
"Constructing new hash sets:"
|
"Constructing new hash sets:"
|
||||||
{ $subsections <hash-set> >hash-set }
|
{ $subsections <hash-set> >hash-set }
|
||||||
|
@ -11,7 +11,7 @@ ARTICLE: "hash-sets" "Hash sets"
|
||||||
ABOUT: "hash-sets"
|
ABOUT: "hash-sets"
|
||||||
|
|
||||||
HELP: hash-set
|
HELP: hash-set
|
||||||
{ $class-description "The class of hashtable-based sets. These implement the " { $link "sets" } "." } ;
|
{ $class-description "The class of hashtable-like sets. These implement the " { $link "sets" } "." } ;
|
||||||
|
|
||||||
HELP: <hash-set>
|
HELP: <hash-set>
|
||||||
{ $values { "capacity" number } { "hash-set" hash-set } }
|
{ $values { "capacity" number } { "hash-set" hash-set } }
|
||||||
|
|
|
@ -83,16 +83,16 @@ TUPLE: hash-set
|
||||||
|
|
||||||
PRIVATE>
|
PRIVATE>
|
||||||
|
|
||||||
: <hash-set> ( n -- hash )
|
: <hash-set> ( capacity -- hash-set )
|
||||||
hash-set new [ reset-hash ] keep ; inline
|
hash-set new [ reset-hash ] keep ; inline
|
||||||
|
|
||||||
M: hash-set in? ( key hash -- ? )
|
M: hash-set in?
|
||||||
key@ 2nip ;
|
key@ 2nip ;
|
||||||
|
|
||||||
M: hash-set clear-set ( hash -- )
|
M: hash-set clear-set
|
||||||
[ init-hash ] [ array>> [ drop ((empty)) ] map! drop ] bi ;
|
[ init-hash ] [ array>> [ drop ((empty)) ] map! drop ] bi ;
|
||||||
|
|
||||||
M: hash-set delete ( key hash -- )
|
M: hash-set delete
|
||||||
[ nip ] [ key@ ] 2bi [
|
[ nip ] [ key@ ] 2bi [
|
||||||
[ ((tombstone)) ] 2dip set-nth-item
|
[ ((tombstone)) ] 2dip set-nth-item
|
||||||
hash-deleted+
|
hash-deleted+
|
||||||
|
@ -100,13 +100,13 @@ M: hash-set delete ( key hash -- )
|
||||||
3drop
|
3drop
|
||||||
] if ;
|
] if ;
|
||||||
|
|
||||||
M: hash-set cardinality ( hash -- n )
|
M: hash-set cardinality
|
||||||
[ count>> ] [ deleted>> ] bi - ; inline
|
[ count>> ] [ deleted>> ] bi - ; inline
|
||||||
|
|
||||||
: rehash ( hash -- )
|
: rehash ( hash-set -- )
|
||||||
[ members ] [ clear-set ] [ (rehash) ] tri ;
|
[ members ] [ clear-set ] [ (rehash) ] tri ;
|
||||||
|
|
||||||
M: hash-set adjoin ( key hash -- )
|
M: hash-set adjoin ( key hash-set -- )
|
||||||
dup ?grow-hash (adjoin) ;
|
dup ?grow-hash (adjoin) ;
|
||||||
|
|
||||||
<PRIVATE
|
<PRIVATE
|
||||||
|
|
Loading…
Reference in New Issue