Import std.algo.search
Dfs
function
Public Function Dfs<N: Hashable>(start: N, successors: Func(N): N[], goal: Func(N): Bool): N[]?
A path from start to the first node that goal says is one, by depth-first search, which
follows each successor as far as it goes before the next: not the shortest path, but found with
only the path in hand. Null when none it reaches is the goal.
Examples
Local next = Function(n: Int): Int[] => n < 4 ? [n * 2, n * 2 + 1] : []
Expect(Dfs(1, next, Function(n: Int) => n == 5) == [1, 2, 5])Report an issue with this page or with FutureBlitz on GitHub.