export function reduce( set: Set, reducer: (aggregate: AggregateType, element: T) => AggregateType, initialValue?: AggregateType ): AggregateType { if (typeof initialValue === "undefined") { // @ts-ignore return Array.from(set).reduce(reducer); } else { return Array.from(set).reduce(reducer, initialValue); } }