guix-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Proposal for search-input-file


From: Ludovic Courtès
Subject: Re: Proposal for search-input-file
Date: Wed, 16 Aug 2023 16:49:52 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.2 (gnu/linux)

Hi!

Liliana Marie Prikler <liliana.prikler@gmail.com> skribis:

> (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."

This would be equivalent to:

  (dirname (search-input-file inputs "/lib/libfoo.so"))

right?

Another option would be a procedure that does precisely that: return the
parent.

Thoughts?

Ludo’.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]