         return Array(queue)
     }
     
+    public func skeleton(_ dim: Int) -> [Simplex] {
+        return allSubsimplices().filter{$0.dim <= dim}
+    }
+    
     public var hashValue: Int {
         return description.hashValue
     }

                    return res + R(sgn(i)) * M(t)
                }
            }
            return F(map)
        }
        bmaps += [F.zero]
        

}

public struct SimplicialComplex {
    public let simplices: Set<Simplex>
    
    public init<S: Sequence>(_ simplices: S, generate: Bool = false) where S.Iterator.Element == Simplex {
        self.simplices = generate ?
            simplices.reduce(Set()) { $0.union($1.allSubsimplices()) }
            : Set(simplices)
    }
    
    public func chainComplex<R: Ring>() -> ChainComplex<Simplex, R> {
