[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Proposal for search-input-file
From: |
( |
Subject: |
Re: Proposal for search-input-file |
Date: |
Tue, 15 Aug 2023 17:53:42 +0100 |
Liliana Marie Prikler <liliana.prikler@gmail.com> writes:
> I think the most general definition that's still useful is this
>
> (define* (search-input-file* inputs predicate
> #:key (hint "<unknown>"))
> "Find the first file in INPUTS matching PREDICATE. The return value
> of PREDICATE is returned as-is, so patterns like
> (search-input-file* inputs
> (lambda (parent)
> (and (file-exists? (string-append parent \"/lib/foobar.so\"))
> (string-append parent \"/lib\"))))
> work as expected.
>
> When PREDICATE returns no match, raise a search error using HINT for a
> file name."
> (match inputs
> (((_ . directories) ...)
> (or (any predicate directories)
> (raise (condition
> (&search-error (path directories)
> (file hint))))))))
You're right; this is better.
-- (