From 931b5cc9bda9b9b1f6cfe979da8520639f7af2b2 Mon Sep 17 00:00:00 2001 From: John Benediktsson Date: Fri, 8 Mar 2013 06:15:27 -0800 Subject: [PATCH] hash-sets: fix help-lint warnings. --- core/hash-sets/hash-sets-docs.factor | 4 ++-- core/hash-sets/hash-sets.factor | 14 +++++++------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/core/hash-sets/hash-sets-docs.factor b/core/hash-sets/hash-sets-docs.factor index cee49ef930..7b8df4d23f 100644 --- a/core/hash-sets/hash-sets-docs.factor +++ b/core/hash-sets/hash-sets-docs.factor @@ -2,7 +2,7 @@ USING: help.markup help.syntax math sequences ; IN: 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 } "Constructing new hash sets:" { $subsections >hash-set } @@ -11,7 +11,7 @@ ARTICLE: "hash-sets" "Hash sets" ABOUT: "hash-sets" 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: { $values { "capacity" number } { "hash-set" hash-set } } diff --git a/core/hash-sets/hash-sets.factor b/core/hash-sets/hash-sets.factor index 971d4baf6f..1d2f0ec7d6 100644 --- a/core/hash-sets/hash-sets.factor +++ b/core/hash-sets/hash-sets.factor @@ -83,16 +83,16 @@ TUPLE: hash-set PRIVATE> -: ( n -- hash ) +: ( capacity -- hash-set ) hash-set new [ reset-hash ] keep ; inline -M: hash-set in? ( key hash -- ? ) +M: hash-set in? key@ 2nip ; -M: hash-set clear-set ( hash -- ) +M: hash-set clear-set [ init-hash ] [ array>> [ drop ((empty)) ] map! drop ] bi ; -M: hash-set delete ( key hash -- ) +M: hash-set delete [ nip ] [ key@ ] 2bi [ [ ((tombstone)) ] 2dip set-nth-item hash-deleted+ @@ -100,13 +100,13 @@ M: hash-set delete ( key hash -- ) 3drop ] if ; -M: hash-set cardinality ( hash -- n ) +M: hash-set cardinality [ count>> ] [ deleted>> ] bi - ; inline -: rehash ( hash -- ) +: rehash ( hash-set -- ) [ members ] [ clear-set ] [ (rehash) ] tri ; -M: hash-set adjoin ( key hash -- ) +M: hash-set adjoin ( key hash-set -- ) dup ?grow-hash (adjoin) ;