diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2019-10-15 08:22:31 -0700 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2019-10-15 08:22:31 -0700 |
commit | c59462de5168b4050ff8517e8215a7692949e85b (patch) | |
tree | 86034617a282ef482b923c82034e3f7f4f8724c1 /txr.1 | |
parent | 738322db5d9a0fecbdce363517308c90a573a48c (diff) | |
download | txr-c59462de5168b4050ff8517e8215a7692949e85b.tar.gz txr-c59462de5168b4050ff8517e8215a7692949e85b.tar.bz2 txr-c59462de5168b4050ff8517e8215a7692949e85b.zip |
tree: api: harmonize deletion with insertion.
* tree.c (tree_delete): Renamed to tree_delete_node.
(tree_delete): New function which returns element
rather than node.
(tree_root): Registered tree-delete-node intrinsic.
* txr.1: Documented.
Diffstat (limited to 'txr.1')
-rw-r--r-- | txr.1 | 33 |
1 files changed, 30 insertions, 3 deletions
@@ -45463,13 +45463,13 @@ A possible implementation is this: (key node))) .brev -.coNP Function @ tree-delete +.coNP Function @ tree-delete-node .synb -.mets (tree-delete < tree << key ) +.mets (tree-delete-node < tree << key ) .syne .desc The -.code tree-delete +.code tree-delete-node function searches .meta tree for an element which matches @@ -45493,6 +45493,33 @@ Otherwise, if a matching element is not found, then .code nil is returned. +.coNP Function @ tree-delete +.synb +.mets (tree-delete < tree << key ) +.syne +.desc +The +.code tree-delete +function tries to removes from +.meta tree +the element which matches +.metn key . + +If successful, it returns that element, otherwise it returns +.codn nil . + +Note: the semantics of the +.code tree-delete +function can be understood in terms of +.codn tree-delete-node . +A possible implementation is this: + +.verb + (defun tree-delete (tree key) + (iflet ((node (tree-delete-node tree key))) + (key node))) +.brev + .coNP Function @ tree-root .synb .mets (tree-root < tree ) |