I'm trying to make n-nested loops method in Julia
function fun(n::Int64)
@nloops n i d->1:3 begin\n
@nexprs n j->(print(i_j))\n
end
end
But the definition of @nloops is limited
_nloops(::Int64, ::Symbol, ::Expr, ::Expr...)
and I get an error
_nloops(::Symbol, ::Symbol, ::Expr, ::Expr)
Is there any way to make this work? Any help is much appreciated
EDIT:
As a result, I used the combination method
For my problem, I needed to get all k-combinations of indices to pull values from an array, so the loops should have looked like
for i_1 in 1:100
for i_2 in i_1:100
...
for i_k in i_[k-1]:100
source
share