P369: Enumeration of all partitions of a set

P369: Enumeration of all partitions of a set
Input:
A set $S$.
Output:
All partitions of $S$.
Complexity:
$O(1)$ amortized time per solution.
Comment:
Reference:
[Semba1984] (Bibtex)