Updating linked-assocs documentation, add <linked-assoc> word
parent
b4683bb00b
commit
5c6860fd0f
|
@ -2,22 +2,22 @@ IN: linked-assocs
|
||||||
USING: help.markup help.syntax assocs ;
|
USING: help.markup help.syntax assocs ;
|
||||||
|
|
||||||
HELP: linked-assoc
|
HELP: linked-assoc
|
||||||
{ $class-description "The class of linked assocs. Linked assoc are implemented by combining an assocs and a dlist. The assoc is used for lookup and retrieval of single values, while the dlist is used for getting lists of keys/values, which will be in insertion order." } ;
|
{ $class-description "The class of linked assocs. Linked assoc are implemented by combining an assoc with a dlist. The assoc is used for lookup and retrieval of single values, while the dlist is used for getting lists of keys/values, which will be in insertion order." } ;
|
||||||
|
|
||||||
|
HELP: <linked-assoc>
|
||||||
|
{ $values { "exemplar" "an exemplar assoc" } }
|
||||||
|
{ $description "Creates an empty linked assoc backed by a new instance of the same type as the exemplar." } ;
|
||||||
|
|
||||||
HELP: <linked-hash>
|
HELP: <linked-hash>
|
||||||
{ $values { "assoc" "A new linked-assoc" } }
|
{ $values { "assoc" linked-assoc } }
|
||||||
{ $description "Creates a new, empty linked assoc." } ;
|
{ $description "Creates an empty linked assoc backed by a hashtable." } ;
|
||||||
|
|
||||||
ARTICLE: "linked-assocs" "Linked assocs"
|
ARTICLE: "linked-assocs" "Linked assocs"
|
||||||
"A " { $emphasis "linked assoc" } " is an assoc which combines a hash table and a dlist to form a structure which has the insertion and retrieval characteristics of a hash table, but with the ability to get the items in insertion order."
|
"A " { $emphasis "linked assoc" } " is an assoc which combines an underlying assoc with a dlist to form a structure which has the insertion and retrieval characteristics of the underlying assoc (typically a hashtable), but with the ability to get the entries in insertion order by calling " { $link >alist } "."
|
||||||
$nl
|
$nl
|
||||||
"Linked assocs implement the following methods from the assoc protocol:"
|
"Linked assocs are implemented in the " { $vocab-link "linked-assocs" } " vocabulary."
|
||||||
{ $subsection at* }
|
{ $subsection linked-assoc }
|
||||||
{ $subsection assoc-size }
|
{ $subsection <linked-hash> }
|
||||||
{ $subsection >alist }
|
{ $subsection <linked-assoc> } ;
|
||||||
{ $subsection set-at }
|
|
||||||
{ $subsection delete-at }
|
|
||||||
{ $subsection clear-assoc }
|
|
||||||
{ $subsection >alist } ;
|
|
||||||
|
|
||||||
ABOUT: "linked-assocs"
|
ABOUT: "linked-assocs"
|
|
@ -1,12 +1,15 @@
|
||||||
! Copyright (C) 2008 Slava Pestov, James Cash.
|
! Copyright (C) 2008 Slava Pestov, James Cash.
|
||||||
! See http://factorcode.org/license.txt for BSD license.
|
! See http://factorcode.org/license.txt for BSD license.
|
||||||
USING: accessors assocs arrays kernel deques dlists sequences hashtables fry ;
|
USING: accessors assocs arrays kernel deques dlists sequences fry ;
|
||||||
IN: linked-assocs
|
IN: linked-assocs
|
||||||
|
|
||||||
TUPLE: linked-assoc assoc dlist ;
|
TUPLE: linked-assoc assoc dlist ;
|
||||||
|
|
||||||
|
: <linked-assoc> ( exemplar -- assoc )
|
||||||
|
0 swap new-assoc <dlist> linked-assoc boa ;
|
||||||
|
|
||||||
: <linked-hash> ( -- assoc )
|
: <linked-hash> ( -- assoc )
|
||||||
0 <hashtable> <dlist> linked-assoc boa ;
|
H{ } <linked-assoc> ;
|
||||||
|
|
||||||
M: linked-assoc assoc-size assoc>> assoc-size ;
|
M: linked-assoc assoc-size assoc>> assoc-size ;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue