Given a fn, we may wish to run it on a filepath, determine
its success, and try again with the parent directory of filepath,
until we obtain result that is not NULL. If this does not occur for
any parent directory, we halt with the string error.
traverse_parent_directories(filepath, fn, error)character. The filepath to traverse along. The fn
function will be called with filepath and its parent directories
until it returns a result other than NULL.
function. A one-argument function called on filepath or
its successive parent directories until a result other than NULL
is returned, which will be the final return value.
character or function. A string to error if fn returns
NULL on all parent directories, or a one-argument function to
execute (the argument received will be the initial filepath)
The result of fn on the first parent directory of
filepath on which it is not NULL.