node-list-last-element
Name
node-list-last-element -- Return the last element node in a node list
Synopsis
(node-list-last-element nodelist)
Description
This function returns the last node in a node list which is
an element (as opposed to a PI or anything else that might appear
in a node list).
Author
Norman Walsh, <ndw@nwalsh.com>
Source Code
(define (node-list-last-element nodelist)
  ;; Return the last element node in a node list
  (let loop ((el (empty-node-list)) (nl nodelist))
    (if (node-list-empty? nl)
	el
	(if (gi (node-list-first nl))
	    (loop (node-list-first nl) (node-list-rest nl))
	    (loop el (node-list-rest nl))))))