Returns the mapping over nl of the function on a node that returns
the reflexive siblings of the node, where the reflexive siblings of
a node are defined to be the value of the origin-to-subnode
relationship property
of the node's origin, if the node has an origin, and otherwise
the node itself.
This could be defined as follows:
(define (rsiblings nl)
(node-list-map (lambda (snl)
(let ((rel (origin-to-subnode-rel snl)))
(if rel
(node-property rel
(origin snl)
default: (empty-node-list))
snl)))
nl))
(ipreced nl)
Returns the mapping over nl of the function on a node that returns
the immediately preceding sibling of the node, if any.
This could be defined as follows:
(define (ipreced nl)
(node-list-map (lambda (snl)
(let loop ((prev (empty-node-list))
(rest (siblings snl)))
(cond ((node-list-empty? rest)
(empty-node-list))
((node-list=? (node-list-first rest) snl)
prev)
(else
(loop (node-list-first rest)
(node-list-rest rest))))))
nl))
(ifollow nl)
Returns the mapping over nl of the function on a node that returns
the immediately following sibling of the node, if any.
This could be defined as follows:
(define (ifollow nl)
(node-list-map (lambda (snl)
(let loop ((rest (siblings snl)))
(cond ((node-list-empty? rest)
(empty-node-list))
((node-list=? (node-list-first rest) snl)
(node-list-first (node-list-rest rest)))
(else
(loop (node-list-rest rest))))))
nl))
(preced nl)
Returns the mapping over nl of the function on a node that returns
the preceding siblings of the node, if any.
This could be defined as follows:
(define (preced nl)
(node-list-map (lambda (snl)
(let loop ((scanned (empty-node-list))
(rest (siblings snl)))
(cond ((node-list-empty? rest)
(empty-node-list))
((node-list=? (node-list-first rest) snl)
scanned)
(else
(loop (node-list scanned
(node-list-first rest))
(node-list-rest rest))))))
nl))
(follow nl)
Returns the mapping over nl of the function on a node that returns
the following siblings of the node, if any.
This could be defined as follows:
(define (follow nl)
(node-list-map (lambda (snl)
(let loop ((rest (siblings snl)))
(cond ((node-list-empty? rest)
(empty-node-list))
((node-list=? (node-list-first rest) snl)
(node-list-rest rest))
(else
(loop (node-list-rest rest))))))
nl))
(grove-before? snl1 snl2)
Returns #t if snl1 is strictly before snl2 in
grove order. It is an error if snl1 and snl2 are
not in the same grove. This could be defined as follows:
(define (grove-before? snl1 snl2)
(let ((sorted
(node-list-intersection (subgrove (grove-root snl1))
(node-list snl1 snl2))))
(and (= (node-list-length sorted) 2)
(node-list=? (node-list-first sorted) snl1))))
(sort-in-tree-order nl)
Returns the members of nl sorted in tree order. Any duplicates
shall be removed. It is an error if the members of nl are not all
in the same tree. This could be defined as follows:
(define (sort-in-tree-order nl)
(node-list-intersection (subtree (tree-root nl))
nl))
(tree-before? snl1 snl2)
Returns #t if snl1 is strictly before snl2 in tree
order. It is an error if snl1 and snl2 are not in
the same tree. This could be defined as follows:
(define (tree-before? snl1 snl2)
(let ((sorted
(sort-in-tree-order (node-list snl1 snl2))))
(and (= (node-list-length sorted) 2)
(node-list=? (node-list-first sorted) snl1))))
(tree-before nl)
Returns the mapping over nl of the function on a node that returns
those nodes in the same tree as the node that are before the node.
This could be defined as follows:
(define (tree-before nl)
(node-list-map (lambda (snl)
(node-list-filter (lambda (x)
(tree-before? x snl))
(subtree (tree-root snl))))
nl))
(property-lookup propname snl if-present if-not-present)
If snl exhibits a non-null value for the property propname,
property-lookup returns the result of applying if-present to
that value, and otherwise returns the result of calling
if-not-present without
arguments. propname can be specified in any of the ways allowed
for the node-property procedure. This could be defined as
follows:
(define (property-lookup name snl if-present if-not-present)
(let ((val (node-property name snl default: #f)))
(cond (val (if-present val))
((node-property name snl default: #t) (if-not-present))
(else (if-present val)))))
(select-by-class nl sym)
Returns a node-list comprising members of nl that have node
class sym. sym is either the application name (transformed as
specified in section 10.1.5, Application Name Transformation) or the RCS name
of the class.
(select-by-property nl sym proc)
Returns a node-list comprising those
members of nl that have a non-nodal property named sym that
exhibits a non-null value such that proc applied to it returns a
true value.
(select-by-null-property nl sym)
Returns a node-list comprising members of nl for which the
property sym exhibits a null value.
(select-by-missing-property nl sym)
Returns a node-list comprising members of nl for which
the property sym does not exhibit a value.