I know that Subsets[list]
gives the power set of list and Subsets[list,{k}]
gives all subsets containing exactly $k$ elements.
They all give all the subsets at once. I want to output them iteratively.
I saw that Wolfram has a package called Lazy. I installed it according to the instructions. However, when I tried to run the code below, it didn't work.
Needs["Wolfram`Lazy`"]
LazySubsets[{1, 2, 3}]
It will output as it is.
Or when I enter the following code, it even throws an error.
LazySubsets[{1, 2}]
Lazy::undef: function
LazyMap
is undefined for the argumentLazySubsets[2]
.
Lazy::undef: function
LazyJoin
is undefined for the argumentLazyMap[LazyPrepend[#1, 1]&, LazySubsets[2]]
.
I am not quite sure how to use this function either.