]> gitweb.factorcode.org Git - factor.git/blobdiff - core/hashtables/hashtables-docs.factor
ui.listener: document that ~/.factor-history persists input history
[factor.git] / core / hashtables / hashtables-docs.factor
index e0397e2042551dd73034d9b0f0b12a257672bdf0..972a659971591b3f731c334c5669aff8d8738327 100644 (file)
@@ -1,12 +1,10 @@
-USING: hashtables.private help.markup help.syntax
-kernel prettyprint generic sequences sequences.private
-namespaces assocs ;
+USING: assocs help.markup help.syntax kernel hashtables.private ;
 IN: hashtables
 
 ARTICLE: "hashtables.private" "Hashtable implementation details"
-"This hashtable implementation uses only one auxilliary array in addition to the hashtable tuple itself. The array stores keys in even slots and values in odd slots. Values are looked up with a hashing strategy that uses linear probing to resolve collisions."
+"This hashtable implementation uses only one auxiliary array in addition to the hashtable tuple itself. The array stores keys in even slots and values in odd slots. Values are looked up with a hashing strategy that uses quadratic probing to resolve collisions."
 $nl
-"There are two special objects: the " { $link ((tombstone)) } " marker and the " { $link ((empty)) } " marker. Neither of these markers can be used as hashtable keys."
+"There are two special objects: the " { $link +tombstone+ } " marker and the " { $link +empty+ } " marker. Neither of these markers can be used as hashtable keys."
 $nl
 "The " { $snippet "count" } " slot is the number of entries including deleted entries, and " { $snippet "deleted" } " is the number of deleted entries."
 { $subsections
@@ -59,28 +57,28 @@ ARTICLE: "hashtables.utilities" "Hashtable utilities"
 ABOUT: "hashtables"
 
 HELP: hashtable
-{ $description "The class of hashtables. See " { $link "syntax-hashtables" } " for syntax and " { $link "hashtables" } " for general information." } ;
+{ $class-description "The class of hashtables. See " { $link "syntax-hashtables" } " for syntax and " { $link "hashtables" } " for general information." } ;
 
 HELP: hash@
 { $values { "key" "a key" } { "array" "the underlying array of a hashtable" } { "i" "the index to begin hashtable search" } }
 { $description "Computes the index to begin searching from the hashcode of the key. Always outputs an even value since keys are stored at even indices of the underlying array." } ;
 
 HELP: probe
-{ $values { "array" "the underlying array of a hashtable" } { "i" "a search index" } }
+{ $values { "array" "the underlying array of a hashtable" } { "i" "a search index" } { "probe#" "an incrementing counter" } }
 { $description "Outputs the next hashtable search index." } ;
 
 HELP: key@
 { $values { "key" "a key" } { "hash" hashtable } { "array" "the underlying array of the hashtable" } { "n" "the index of the key" } { "?" "a boolean indicating whether the key was present" } }
-{ $description "Searches the hashtable for the key using a linear probing strategy. Searches stop if either the key or an " { $link ((empty)) } " sentinel is found. Searches skip the " { $link ((tombstone)) } " sentinel." } ;
+{ $description "Searches the hashtable for the key using a quadratic probing strategy. Searches stop if either the key or an " { $link +empty+ } " sentinel is found. Searches skip the " { $link +tombstone+ } " sentinel." } ;
 
 { key@ new-key@ } related-words
 
 HELP: new-key@
-{ $values { "key" "a key" } { "hash" hashtable } { "array" "the underlying array of the hashtable" } { "n" "the index where the key would be stored" } { "empty?" "a boolean indicating whether the location is currently empty" } }
-{ $description "Searches the hashtable for the key using a linear probing strategy. If the key is not present in the hashtable, outputs the index where it should be stored." } ;
+{ $values { "key" "a key" } { "hash" hashtable } { "array" "the underlying array of the hashtable" } { "n" "the index where the key would be stored" } }
+{ $description "Searches the hashtable for the key using a quadratic probing strategy. If the key is not present in the hashtable, outputs the index where it should be stored." } ;
 
 HELP: set-nth-pair
-{ $values { "value" "the second element of the pair" } { "key" "the first element of the pair" } { "seq" "a sequence" } { "n" "an index in the sequence" } }
+{ $values { "value" "the second element of the pair" } { "key" "the first element of the pair" } { "array" "the underlying array of the hashtable" } { "n" "an index in the sequence" } }
 { $description "Stores a pair of values into the elements with index " { $snippet "n" } " and " { $snippet "n+1" } ", respectively." }
 { $warning "This word is in the " { $vocab-link "hashtables.private" } " vocabulary because it does not perform bounds checks." }
 { $side-effects "seq" } ;
@@ -120,8 +118,8 @@ HELP: associate
 
 HELP: ?set-at
 { $values
-     { "value" object } { "key" object } { "assoc/f" "an assoc or " { $link f } }
-     { "assoc" assoc } }
+    { "value" object } { "key" object } { "assoc/f" "an assoc or " { $link f } }
+    { "assoc" assoc } }
 { $description "If the third input is an assoc, stores the key/value pair into that assoc, or else creates a new hashtable with the key/value pair as its only entry." } ;
 
 HELP: >hashtable