665⟨auxiliary628⟩+≡ (626660669728)⊲661a670⊳ macro V ==CycleIndexVariable; macro T ==SparseIndexedPowerProduct(V,I); local integerPartitions(n:I, bound:I):Generator T == generate { import from V, T; zero? n => yield 1$T; for m in min(n, bound) .. 1 by -1 repeat { for p in integerPartitions(n-m, min(m, bound)) repeat { yield p * power(m::V, 1); } } } local cycleType(p: P): T == { import from V; t: T := 1; for l in p repeat t := t * power((#l)::V, 1); t; } local partitionTest( n:I, expectedStructures: List P, expectedTypes: List P ): () == { import fromPartitionI; s := set([generator(0..prev n)])$SetSpecies(I); k:I := 0; for a in structures(s) repeat k := next k; assertEquals(I, #expectedStructures, k); for a in expectedStructures for p in structures(s) repeat { assertEquals(P, a, p::P); } k := 0; for a in isomorphismTypes(s) repeat k := next k; assertEquals(I, #expectedTypes, k); for a in expectedTypes for p in isomorphismTypes(s) repeat { assertEquals(P, a, p::P); } k := 0; for t in integerPartitions(n, n) repeat k := next k; assertEquals(I, #expectedTypes, k); for a in expectedTypes for t in integerPartitions(n, n) repeat { assertEquals(T, cycleType a, t); } } UsesCycleIndexVariable329, Generator617, I47, Partition146, SetSpecies117,andSparseIndexedPowerProduct506.
666a⟨test set partition666a⟩≡ (660)666b⊳ testPartition0(): () == partitionTest(0, [[]], [[]]);
666b⟨test set partition666a⟩+≡ (660)⊲666a666c⊳ testPartition1(): () == partitionTest(1, [[[0]]], [[[0]]]);