# lib_math function library

Dependencies: lib_2da, lib_anon, lib_array, lib_fn, lib_ini, lib_sfo, lib_sugar, lib_tools, lib_ui

## Description

Various functions that do things that are abstractly mathematical, mostly to do with relations. If the function descriptions don't make sense, you should probably study more predicate logic.

## Public functions

math_transitive_closure(relation:s)=(relation:a) dimorphic

Given a 2 place relation defined by a 2D array s.t. array(k,v)=1 iff Rkv, construct its transitive closure.

math_traverse_directories(directory:s)=(array:a) action

Given a directory, recursively return itself and its subdirectories and their subdirectories, etc. as an array in k=>_ form

math_traverse_graph(max_iterations:i=1000, silent:b, telemetry:b, start:s, relates_to:f, parameter:s)=(visited_nodes:a) dimorphic

Given: - a string 'start' - an action function 'relates_to' that maps strings ('arguments') to arrays of strings 'array', and takes an optional argument 'parameter'

return an array 'visited_nodes' of all strings connected to the original string by the transitive closure of the 'relates_to' relation.

Gives up after 'max_iterations' iterations. Set silent to 1 to be told when it's finished, and telemetry to 1 to get a bit more information.

## Internal functions

These should not be called from outside the library itself.

get_subdirectories_helper(arguments:s, parameter:s)=(array:a) action

tc_helper(arguments:s, parameter:s)=(array:a) action