ipreced

Name

ipreced -- Implements ipreced as per ISO/IEC 10179:1996

Synopsis

(ipreced nl)

Description

Implements ipreced as per ISO/IEC 10179:1996

Author

From ISO/IEC 10179:1996

Source Code

(define (ipreced nl)
  ;; Implements ipreced as per ISO/IEC 10179:1996
  (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))