XPost: comp.lang.scheme
Kaz Kylheku wrote:
(defun tree-find (needle haystack &key (test #'eql))
(dolist (item haystack)
(if (funcall test needle item)
(return item)
(when (consp item)
(let ((find (tree-find needle item :test test)))
(when find
(return find)))))))
Gauche Scheme:
(define (tree-find needle haystack :optional (test equal?))
(any
(lambda (item)
(if (test needle item)
item
(and (pair? item) (tree-find needle item test))))
haystack))
--- SoupGate-Win32 v1.05
* Origin: fsxNet Usenet Gateway (21:1/5)