/*  --- University of Sussex POPLOG file -----------------------------------
 *  File:           $usepop/pop/local/plog/lib/searchlib.pl
 *  Purpose:        Find a file in the library directory and get its full name
 *  Author:         Chris Mellish, ???
 *  Machines:       all
 *  Documentation:  HELP * SEARCHLIB
 *  Related Files:
 */

:- library(exists).

searchlib(Partial,Complete) :-
   Dirs is valof(prologliblist),
   '$member'(Dir,Dirs),
   Word is consword(><(quote(Dir),><('/',quote(Partial)))),
   exists(Word), !,
   Complete = Word.

   '$member'(X,[X|_]).
   '$member'(X,[_|L]) :- '$member'(X,L).
