query
On this page

listDfs

lib.listDfs

Docs pulled from | This Revision | 21 minutes ago


Depth-First Search (DFS) for lists list != [].

before a b == true means that b depends on a (there's an edge from b to a).

Inputs

stopOnCycles

1. Function argument

before

2. Function argument

list

3. Function argument

Examples

lib.lists.listDfs usage example

listDfs true hasPrefix [ "/home/user" "other" "/" "/home" ]
  == { minimal = "/";                  # minimal element
       visited = [ "/home/user" ];     # seen elements (in reverse order)
       rest    = [ "/home" "other" ];  # everything else
     }

listDfs true hasPrefix [ "/home/user" "other" "/" "/home" "/" ]
  == { cycle   = "/";                  # cycle encountered at this element
       loops   = [ "/" ];              # and continues to these elements
       visited = [ "/" "/home/user" ]; # elements leading to the cycle (in reverse order)
       rest    = [ "/home" "other" ];  # everything else
(lib.lists.listDfs)

Noogle also knows

Aliases