MCPcopy Index your code
hub / github.com/clips/pattern / flatten

Function flatten

pattern/graph/graph.js:1294–1301  ·  view source on GitHub ↗
(array)

Source from the content-addressed store, hash-verified

1292 */
1293 // Based on: Connelly Barnes, http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/119466
1294 function flatten(array) {
1295 // Flattens a linked list of the form [0,[1,[2,[]]]]
1296 var a = [];
1297 for (var i=0; i < array.length; i++) {
1298 (array[i] instanceof Array)? a=a.concat(flatten(array[i])) : a.push(array[i]);
1299 }
1300 return a;
1301 }
1302 var G = Graph.adjacency(graph, a);
1303 var q = new Heap(); q.push([0, id1, []], 0);
1304 var visited = {};

Callers 1

graph.jsFile · 0.70

Calls 1

pushMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…