traverse_parent_directories: Perform an action repeatedly on parent directories until...

Description Usage Arguments Value

Description

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.

Usage

1
traverse_parent_directories(filepath, fn, error)

Arguments

filepath

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.

fn

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.

error

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)

Value

The result of fn on the first parent directory of filepath on which it is not NULL.


robertzk/syberia documentation built on May 27, 2019, 11:37 a.m.