Closed guicho271828 closed 11 years ago
There is supposed to be a method to the naming though ideas did change over time so I doubt it's as consistent as one would like.
The idea is that some containers store items directly (e.g., a list-container or an array-container) whereas others store items inside of nodes (e.g., a heap-container). The -element methods operate on the what you put in (i.e., if the container has nodes, then iterate-elements will use the element function to get at the thing in the node. The -nodes and *-item methods operate on the nodes. If a container doesn't use nodes, then the methods are the same.
For example, the method on iterate-elements for abstract-containers just iterates the nodes but if the container uses nodes, it iterates the contents of (i.e., the element of) the node.
(defmethod iterate-elements ((container abstract-container) fn) (iterate-nodes container fn))
(defmethod iterate-elements ((container container-uses-nodes-mixin) fn) (iterate-nodes container (lambda (x) (funcall fn (element x)))))
likewise, delete-item looks for the node whereas delete-element looks for the contents of the node.
I'm sorry things aren't better documented :-( but hope this helps,
On Jan 26, 2013, at 3:48 AM, Masataro Asai notifications@github.com wrote:
Hi, Personally I was first confused by the naming of methods, because some methods are named "-element" and others are "-item". I guess some of "-element" methods are related to arrays but it seems inconsistent... Are there any differences between the meanings in those names? Or, is it for the backward compatibility or something?
— Reply to this email directly or view it on GitHub.
Gary Warren King, metabang.com Cell: (413) 559 8738 Fax: (206) 338-4052 gwkkwg on Skype * garethsan on AIM * gwking on twitter
Hi, Personally I was first confused by the naming of methods, because some methods are named "-element" and others are "-item". I guess some of "-element" methods are related to arrays but it seems inconsistent... Are there any differences between the meanings in those names? Or, is it for the backward compatibility or something?