function AllSubSets(a: array of T; i: integer; lst: List): sequence of List; begin if i = a.Length then begin yield lst; exit; end; lst.Add(a[i]); yield sequence AllSubSets(a, i + 1, lst); lst.RemoveAt(lst.Count-1); yield sequence AllSubSets(a, i + 1, lst); end; begin AllSubSets(Arr(1..4),0,new List).Print; end.