| Deutsch English Français Italiano |
|
<vcbnu7$3g15u$1@dont-email.me> View for Bookmarking (what is this?) Look up another Usenet article |
Path: ...!news.nobody.at!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: "B. Pym" <Nobody447095@here-nor-there.org>
Newsgroups: comp.lang.lisp,comp.lang.scheme
Subject: Re: chain of transformations
Date: Tue, 17 Sep 2024 11:07:52 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 20
Message-ID: <vcbnu7$3g15u$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=iso-8859-1
Injection-Date: Tue, 17 Sep 2024 13:07:53 +0200 (CEST)
Injection-Info: dont-email.me; posting-host="a46abdd1c4c6debf9f002d978f341ceb";
logging-data="3671230"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18XG86ESvwN6O4ye93fleWb"
User-Agent: XanaNews/1.18.1.6
Cancel-Lock: sha1:GbZobT36+hVwHp5YBly3LJfpgZc=
Bytes: 1399
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))