Returns #t if, for some member of nl, proc does not return #f
when applied to a singleton node-list containing just that member, and
otherwise returns #f.  An implementation is allowed, but not required,
to signal an error if, for some member of nl, proc would signal
an error when applied to a singleton node-list containing just that
member.  This could be defined as follows:
(define (node-list-some? proc nl)
  (node-list-reduce nl
                    (lambda (result snl)
                      (if (or result (proc snl))
                          #t
                          #f))
                    #f))
(node-list-every? proc nl)
Returns #t if, for every member of nl, proc does not return
#f
when applied to a singleton node-list containing just that member, and
otherwise returns #f.  An implementation is allowed
to signal an error if, for some member of nl, proc would signal
an error when applied to a singleton node-list containing just that
member.  This could be defined as follows:
(define (node-list-every? proc nl)
  (node-list-reduce nl
                    (lambda (result snl)
                      (if (and result (proc snl))
                          #t
                          #f))
                    #t))
(node-list-filter proc nl)
Returns a node-list containing just those members of nl
for which proc applied to a singleton node-list containing
just that member does not return #f.
This could be defined as follows:
(define (node-list-filter proc nl)
  (node-list-reduce nl
                    (lambda (result snl)
                      (if (proc snl)
                          (node-list snl result)
                          result))
                    (empty-node-list)))
(node-list->list nl)
Returns a list containing, for each member of nl, a singleton
node-list containing just that member.  This could be defined as
follows:
(define (node-list->list nl)
  (reverse (node-list-reduce nl
                             (lambda (result snl)
                               (cons snl result))
                             '())))
(node-list-length nl)
Returns the length of nl.
This could be defined as follows:
(define (node-list-length nl)
  (node-list-reduce nl
                    (lambda (result snl)
                      (+ result 1))
                    0))
(node-list-reverse nl)
Returns a node-list containing the members of nl in reverse order.
This could be defined as follows:
(define (node-list-reverse nl)
  (node-list-reduce nl
                    (lambda (result snl)
                      (node-list snl result))
                    (empty-node-list)))
(node-list-ref nl k)
Returns a node-list containing the kth member of nl
(zero-based), if there is such a member, and otherwise returns the
empty node-list.  This could be defined as follows:
(define (node-list-ref nl i)
  (cond ((< i 0)
         (empty-node-list))
        ((zero? i)
         (node-list-first nl))
        (else
         (node-list-ref (node-list-rest nl) (- i 1)))))
(node-list-tail nl k)
Returns the node-list comprising all but the first k members of nl.
If nl has k or fewer members, returns the empty node-list.
This could be defined as follows:
(define (node-list-tail nl i)
  (cond ((< i 0) (empty-node-list))
        ((zero? i) nl)
        (else
         (node-list-tail (node-list-rest nl) (- i 1)))))
(node-list-head nl k)
Returns a node-list comprising the first k members of nl.
If nl has k or fewer members, returns nl.
This could be defined as follows.
(define (node-list-head nl i)
  (if (zero? i)
      (empty-node-list)
      (node-list (node-list-first nl)
                 (node-list-head nl (- i 1)))))
(node-list-sublist nl k1 k2)
Returns a node-list containing those members of nl that are
preceded in nl by at least k1 members but fewer than
k2 members.  This is equivalent to selecting those members
whose zero-based index in nl is greater than or equal to
k1 but less than k2.  This could be defined as
follows:
(define (node-list-sublist nl i j)
  (node-list-head (node-list-tail nl i)
                  (- j i)))
(node-list-count nl)
Returns the number of distinct members of nl.
This could be defined as follows:
(define (node-list-count nl)
  (node-list-length (node-list-remove-duplicates nl)))
(node-list-last nl)
Returns a node-list containing the last member of nl, if nl
is not empty, and otherwise returns the empty node-list.
This could be defined as follows:
(define (node-list-last nl)
  (node-list-ref nl
                 (- (node-list-length nl) 1)))
When using node-list-some?, node-list-every?,
node-list-filter, and node-list-union-map, the first
argument is often a lambda expression with a variable.  A syntax
that avoids the need to use an explicit lambda expression in this case
is provided in this International Standard.
[146] special-query-expression = there-exists?-expression
| for-all?-expression
| select-each-expression
| union-for-each-expression
[147] there-exists?-expression = (there-exists?
variable
expression
expression)
An expression
(there-exists? var nl-expr expr)
is equivalent to:
(node-list-some? (lambda (var) expr) nl-expr)
Read this as: there exists a var in nl-expr such that
expr.
[148] for-all?-expression = (for-all?
variable
expression
expression
)
An expression
(for-all? var nl-expr expr)
is equivalent to:
(node-list-every? (lambda (var) expr) nl-expr)
Read this as: for all var in nl-expr, expr.
[149] select-each-expression = (select-each
variable
expression
expression)
An expression
(select-each var nl-expr expr)
is equivalent to:
(node-list-filter (lambda (var) expr) nl-expr)
Read this as: select each var in nl-expr such that expr.
[150] union-for-each-expression = (union-for-each
variable
expression
expression)
An expression
(union-for-each var nl-expr expr)
is equivalent to:
(node-list-union-map (lambda (var) expr) nl-expr)
Read this as: the union of, for each var in nl-expr,
expr.