And then you can reduce that result into a simple 1-dimentional list like so:
516429
function reduceByDepth(depthTree) {
    var order = 0
      , handled = {}
      , useInOrder = []
      ;

    // it's important to sort and reverse the key listing so that 
    // the most deeply depended on modules are always installed first and listed first in ender.js
    Object.keys(depthTree).sort().reverse().forEach(function (depth) {
      var depNames = depthTree[depth]
        ;

      depNames.forEach(function (depName) {
        if (!handled[depName]) {
          handled[depName] = true;
          useInOrder.push(depName);
        }
      });

    });

    return useInOrder;
  }
978767
public void simplify()
  {
    // remove all addresses from the cc and bcc that are in the to address set.
    ccSet.removeAll(toSet);
    bccSet.removeAll(toSet);

    // remove all address from the bcc set that are in the cc set.
    bccSet.removeAll(ccSet);
  }
987530
def _reduce_sizes(self, bbox_list):
        
        return [BBox(self._intersection_area(bbox).bounds, self.crs).transform(bbox.crs) for bbox in bbox_list]
200923
def flatten_list(l: List[list]) -> list:
    
    return [v for inner_l in l for v in inner_l]
671344
def _format_list(result):
    """"""

    if not result:
        return result

    if isinstance(result[0], dict):
        return _format_list_objects(result)

    table = Table(['value'])
    for item in result:
        table.add_row([iter_to_table(item)])
    return table
87693
private List<Object> normalizeList(List<Object> list) {
    	List<Object> result = new ArrayList<Object>();
    	for (Object o : list) {
    		if (o == null) {
    			result.add(nullLiteral);
    		} else if (o instanceof Boolean) {
    			result.add(((Boolean) o).toString());
    		} else if (o instanceof List<?>) {
    			result.add(normalizeList((List<Object>) o));
    		} else if (o instanceof Map<?, ?>) {
    			result.add(normalizeMap((Map<String, Object>) o));
    		} else if (!(o instanceof Number)) {
    			result.add(o);
    		}
    	}
    	return result;
    }
1188924
def reduce_to_unit(divider):
    
    for unit_size in range(1, len(divider) // 2 + 1):
        length = len(divider)
        unit = divider[:unit_size]

        # Ignores mismatches in final characters:
        divider_item = divider[:unit_size * (length // unit_size)]
        if unit * (length // unit_size) == divider_item:
            return unit
    return divider
894167
def flatten_list(lobj):
    
    ret = []
    for item in lobj:
        if isinstance(item, list):
            for sub_item in flatten_list(item):
                ret.append(sub_item)
        else:
            ret.append(item)
    return ret
20026
@Override
    public Double reduce(List<Double> values) {
        Double difference = values.get(0);

        for (int i = 1; i < values.size(); i++) {
            Double value = values.get(i);

            if (value == null) {
                continue;
            }
            difference -= value;
        }
        return difference;
    }
294858
private Geometry simplify(Geometry geom, double resolution, double factor){
		Geometry simplifiedGeometry = null;
		
		if( geom instanceof GeometryCollection ){
			GeometryCollection collection = (GeometryCollection)geom;
			boolean isSimplified = false;
			//List<Geometry> newComponents = new Vector<Geometry>();
			
			// Extract basic geometries
			List<Geometry> basicGeometries = new Vector<Geometry>();
			collection.accumulateBasicGeometries(basicGeometries);
			
			List<Point> accumulatedPoints = new Vector<Point>();
			List<LineString> accumulatedLineStrings = new Vector<LineString>();
			List<Polygon> accumulatedPolygons = new Vector<Polygon>();
			
			for(Geometry component : basicGeometries){
				if( component instanceof Point ){
					Point p = (Point)component;
					accumulatedPoints.add(p);
				
				} else if( component instanceof LineString ){
					LineString ls = (LineString)component;
					accumulatedLineStrings.add(ls);
					
				} else if( component instanceof Polygon ){
					Polygon poly = (Polygon)component;
					accumulatedPolygons.add(poly);
				}
			}
			
			List<Geometry> newComponents = new Vector<Geometry>();

			// Deal with polygons in one simplification
			if( accumulatedPolygons.size() > 0 ){
				MultiPolygon polygons = new MultiPolygon(accumulatedPolygons);
				Geometry effectiveComponent = simplify(polygons, resolution, factor);
				if( null != effectiveComponent ){
					isSimplified = true;
					newComponents.add(effectiveComponent);
				} else {
					newComponents.add(polygons);
				}
			}

			// Deal with linestrings in one simplification
			if( accumulatedLineStrings.size() > 0 ){
				MultiLineString linestrings = new MultiLineString(accumulatedLineStrings);
				Geometry effectiveComponent = simplify(linestrings, resolution, factor);
				if( null != effectiveComponent ){
					isSimplified = true;
					newComponents.add(effectiveComponent);
				} else {
					newComponents.add(linestrings);
				}
			}

			// Deal with points in one simplification
			if( accumulatedPoints.size() > 0 ){
				MultiPoint points = new MultiPoint(accumulatedPoints);
				Geometry effectiveComponent = simplify(points, resolution, factor);
				if( null != effectiveComponent ){
					isSimplified = true;
					newComponents.add(effectiveComponent);
				} else {
					newComponents.add(points);
				}
			}
			
			if( isSimplified ){
				simplifiedGeometry = new GeometryCollection(newComponents);
			}
			
		} else if( geom instanceof Point ) {
//			Point point = (Point)geom;
//			
//			double x = Math.round(point.getX() * factor) / factor;
//			double y = Math.round(point.getY() * factor) / factor;
//			if( x != point.getX() 
//			 || y != point.getY() ){
//				simplifiedGeometry = new Point(x,y);
//			}
			
		} else if( geom instanceof LineString ) {
			// The simplification of a LineString might result into a LineString
			// or into a point
			LineString lineString = (LineString)geom;
			boolean isGeneralized = false;
			List<Point> accumulatedPoints = new Vector<Point>();
			Point lastPoint = null;
			
			// Keep track of bounds
			BoundingBox bbox = new BoundingBox();
			
			for(Point point : lineString.getPoints()){
				// Keep track of bounds
				bbox.extendToInclude(point);
				
				Geometry simplifiedPointObj = simplify(point, resolution, factor);
				
				Point simplifiedPoint = null;
				if( null != simplifiedPointObj ){
					isGeneralized = true;
					simplifiedPoint = (Point)simplifiedPointObj;
				} else {
					simplifiedPoint = point;
				}
				
				if( null == lastPoint ){
					lastPoint = simplifiedPoint;
					accumulatedPoints.add(simplifiedPoint);
				} else {
					if( areLocationsColliding(simplifiedPoint, lastPoint, resolution) ){
						isGeneralized = true;
					} else {
						lastPoint = simplifiedPoint;
						accumulatedPoints.add(simplifiedPoint);
					}
				}
			}

			if( isGeneralized ){
				// A change occurred
				if( accumulatedPoints.size() < 2 ){
					// Create a point that represents the centre of the line string
					simplifiedGeometry = bbox.getCentroid();
				} else {
					simplifiedGeometry = new LineString(accumulatedPoints);
				};
			};
			
		} else if( geom instanceof Polygon ) {
			// Might return a polygon or a point
			Polygon polygon = (Polygon)geom;
			boolean newPolygonNeeded = false;
			List<LineString> newRings = new Vector<LineString>();
			
			// First linear ring is the outer limit of polygon
			List<LineString> rings = polygon.getLinearRings();
			LineString firstRing = rings.get(0);
			Geometry simplifiedFirstRing = simplify(firstRing, resolution, factor);
			if( null != simplifiedFirstRing ){
				if( simplifiedFirstRing instanceof Point ){
					// The outer ring was turned into a point. The whole
					// polygon is now a point. Do not process the other rings.
					// Abort and return the point.
					return simplifiedFirstRing;
				} else {
					newPolygonNeeded = true;
					LineString simplifiedLineString = (LineString)simplifiedFirstRing;
					newRings.add(simplifiedLineString);
				}
			} else {
				newRings.add(firstRing);
			}
			
			// The following rings are subtractions from the outer ring
			for(int i=1,e=rings.size(); i<e; ++i){
				LineString innerRing = rings.get(i);
				
				Geometry simplifiedInnerRing = simplify(innerRing,resolution,factor);
				if( null != simplifiedInnerRing ){
					newPolygonNeeded = true;
					if( simplifiedInnerRing instanceof Point ){
						// Drop inner ring
					} else {
						LineString simplifiedLineString = (LineString)simplifiedInnerRing;
						newRings.add(simplifiedLineString);
					}
				} else {
					newRings.add(innerRing);
				}
			}
			
			if( newPolygonNeeded ){
				simplifiedGeometry = new Polygon(newRings);
			}
			
		} else if( geom instanceof MultiPoint ) {
			// A MultiPoint can be simplified into a MultiPoint or
			// a simple Point
			MultiPoint multiPoint = (MultiPoint)geom;
			boolean isGeneralized = false;
			List<Point> accumulatedPoints = new Vector<Point>();
			Point lastPoint = null;
			
			for(Point point : multiPoint.getPoints()){
				Point effectivePoint = point;
				Geometry simplifiedPoint = simplify(point,resolution,factor);
				if( null != simplifiedPoint ){
					isGeneralized = true;
					effectivePoint = (Point)simplifiedPoint;
				}
				
				if( null == lastPoint ) {
					lastPoint = effectivePoint;
					accumulatedPoints.add(effectivePoint);
				} else {
					if( areLocationsColliding(effectivePoint, accumulatedPoints, resolution) ){
						// If this points is colliding with other points, do not
						// add to resulting collection
						isGeneralized = true;
					} else {
						lastPoint = effectivePoint;
						accumulatedPoints.add(effectivePoint);
					}
				}
			}
			
			if( isGeneralized ){
				if( accumulatedPoints.size() < 2 ){
					simplifiedGeometry = accumulatedPoints.get(0);
				} else {
					simplifiedGeometry = new MultiPoint(accumulatedPoints);
				}
			}
			
		} else if( geom instanceof MultiLineString ) {
			// A MultiLineString can be simplified into a MultiLineString, a LineString,
			// a MultiPoint or a Point
			MultiLineString multiLineString = (MultiLineString)geom;
			
			List<LineString> effectiveLineStrings = makeLineStrings(
					multiLineString.getLineStrings(), 
					null, 
					resolution
					);
			
			boolean isGeneralized = false;
			List<LineString> accumulatedLineStrings = new Vector<LineString>();
			List<Point> accumulatedPoints = new Vector<Point>();
			for(LineString lineString : effectiveLineStrings){
				Geometry simplifiedLineString = simplify(lineString, resolution, factor);
				if( null != simplifiedLineString ){
					isGeneralized = true;
					if( simplifiedLineString instanceof Point ){
						Point simplifiedPoint = (Point)simplifiedLineString;
						if( false == areLocationsColliding(simplifiedPoint, accumulatedPoints, resolution) ){
							accumulatedPoints.add(simplifiedPoint);
						}
					} else {
						LineString simplifiedLS = (LineString)simplifiedLineString;
						accumulatedLineStrings.add(simplifiedLS);
					}
				} else {
					accumulatedLineStrings.add(lineString);
				}
			}
			
			if( isGeneralized ){
				if( accumulatedLineStrings.size() > 1 ){
					simplifiedGeometry = new MultiLineString(accumulatedLineStrings);
					
				} else if( accumulatedLineStrings.size() == 1 ){
					simplifiedGeometry = accumulatedLineStrings.get(0);
					
				} else if( accumulatedPoints.size() > 1 ){
					simplifiedGeometry = new MultiPoint(accumulatedPoints);
					
				} else if( accumulatedPoints.size() == 1 ){
					simplifiedGeometry = accumulatedPoints.get(0);
				}
			}
			
		} else if( geom instanceof MultiPolygon ) {
			// A MultiPolygon can be simplified into a MultiPolygon, a Polygon,
			// a MultiPoint or a Point
			MultiPolygon multiPolygon = (MultiPolygon)geom;
			boolean isGeneralized = false;
			List<Polygon> accumulatedPolygons = new Vector<Polygon>();
			List<Point> accumulatedPoints = new Vector<Point>();
			for(Polygon polygon : multiPolygon.getPolygons()){
				Geometry simplifiedPolygon = simplify(polygon, resolution, factor);
				if( null != simplifiedPolygon ){
					isGeneralized = true;
					if( simplifiedPolygon instanceof Point ){
						Point simplifiedPoint = (Point)simplifiedPolygon;
						if( false == areLocationsColliding(simplifiedPoint, accumulatedPoints, resolution) ){
							accumulatedPoints.add(simplifiedPoint);
						}
					} else {
						Polygon simplifiedPoly = (Polygon)simplifiedPolygon;
						accumulatedPolygons.add(simplifiedPoly);
					}
				} else {
					accumulatedPolygons.add(polygon);
				}
			}
			
			if( isGeneralized ){
				if( accumulatedPolygons.size() > 1 ){
					simplifiedGeometry = new MultiPolygon(accumulatedPolygons);
					
				} else if( accumulatedPolygons.size() == 1 ){
					simplifiedGeometry = accumulatedPolygons.get(0);
					
				} else if( accumulatedPoints.size() > 1 ){
					simplifiedGeometry = new MultiPoint(accumulatedPoints);
					
				} else if( accumulatedPoints.size() == 1 ){
					simplifiedGeometry = accumulatedPoints.get(0);
				}
			}
		}
		
		return simplifiedGeometry;
	}
189075
def flatten(L):
    
    if not isinstance(L, list):
        return [L]

    if L == []:
        return L

    return flatten(L[0]) + flatten(L[1:])
1066114
def flatten_list(x: List[Any]) -> List[Any]:
      # noqa
    return [item for sublist in x for item in sublist]
1084529
function flatten(list) {
    return list.reduce(function (acc, item) {
        if (Array.isArray(item)) {
            return acc.concat(flatten(item));
        }
        else {
            return acc.concat(item);
        }
    }, []);
}
173698
def output_reduce_list(path_list, force=False):
    """"""
    output_paths = []
    for path in path_list:
        output_path = output_reduce(path, force=force)
        if output_path:
            output_paths.append(output_path)
    return output_paths
376384
def pad_decr(ids):
  """"""
  if len(ids) < 1:
    return list(ids)
  if not any(ids):
    return []  # all padding.
  idx = -1
  while not ids[idx]:
    idx -= 1
  if idx == -1:
    ids = ids
  else:
    ids = ids[:idx + 1]
  return [i - 1 for i in ids]
432675
def p_declnamelist(self, p):
        ''
        p[0] = p[1] + (p[3],)
        p.set_lineno(0, p.lineno(1))
1207842
function addToList(i, L, R) {
    R[L[i + 1]] = R[i];
    L[R[i]] = L[i + 1];
    R[i] = i + 1;
    L[i + 1] = i;
}