Rocksolid Light

News from da outaworlds

mail  files  register  groups  login

Message-ID:  

Your heart is pure, and your mind clear, and your soul devout.


comp / comp.lang.scheme / Re: chain of transformations

SubjectAuthor
o Re: chain of transformationsB. Pym

1
Subject: Re: chain of transformations
From: B. Pym
Newsgroups: comp.lang.lisp, comp.lang.scheme
Organization: A noiseless patient Spider
Date: Tue, 17 Sep 2024 11:07 UTC
Path: eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: Nobody447095@here-nor-there.org (B. Pym)
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=
View all headers

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))

1

rocksolid light 0.9.8
clearnet tor