I want to produce a vector containing all k-element subsets of a second vector. I know that I can do this by applying vecextract with each k-element subset of the natural numbers 1...n to my original vector.
How can I create that vector of subsets of natural numbers, though? I can see that the command forsubset does nearly what I want, but it's an imperative command, not one which creates a vector. So I could use the following function to print a list of vectors:
f(n,k)=forsubset([n,k],s,print(s))
but I can only capture them by adding each subset to a List() and then converting the List() to a Vec(). This seems clumsy. Is there a better way to do this, perhaps a totally different one?