Am Mittwoch, dem 16.08.2023 um 16:49 +0200 schrieb Ludovic Courtès: > Hi! > > Liliana Marie Prikler <liliana.prik...@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? In the generic case, your needle could be very long, e.g. /lib/python/site-packages/…/something.so → /lib. Granted, it isn't very likely to occur, but build system writers don't always make the smartest decisions.
Cheers