What you want is permutations with replacement. And I'm pretty sure you're right that there is not a function for that in Base.
You can look in base/combinations.jl, or the Iterators.jl package to be sure. Tim Holy's cartesian work (in Base or Cartesian.jl) might also be useful. Cheers, Kevin On Saturday, March 1, 2014, Jonathan Malmaud <[email protected]> wrote: > I'm looking for a combinatoric function that's similar to 'combinations', > except whereas > combinations(1:3, 2) = [1,2], [1,3], [2,3], > I want > somefunction(1:3, 2) = [1, 2], [2,1], [1, 1], [1,3], [2,3], [3,1], [3,2], > [2, 2], [3, 3] > ie enumerate all possible length-2 arrays such that both elements are in > the given iterable. > > It wasn't clear to me there's something in Base that does this. > >
