When compiling below code
Compile[{{data, _Integer, 2}}, Fold[Flatten /@ Flatten[Outer[List, ##, 1], 1] &, data]]
I encountered error messages
Compile::cset: Variable Compile`Variable$8984 of type {_Integer,1} encountered in assignment of type {_Integer,2}.
Compile::extscalar: Compile
Variable$8984=Flatten/@Flatten[Outer[List,Compile`Variable$8984,Compile
GetElement[Compile`Variable$8985,Compile`Variable$8986],1],1] cannot be compiled and will be evaluated externally. The result is assumed to be of type Void.Compile::cset: Variable Compile`Variable$8984 of type {_Integer,1} encountered in assignment of type {_Integer,2}.
Compile::extscalar: Compile
Variable$8984=Flatten/@Flatten[Outer[List,Compile`Variable$8984,Compile
GetElement[Compile`Variable$8985,Compile`Variable$8986],1],1] cannot be compiled and will be evaluated externally. The result is assumed to be of type Void.
I have no assignment in my code, Why such an error? How to deal with it and compile code successfully?
Compile[{}, Fold[Outer[Times, ##, 1] &, {{3}}]]
already triggersCompile::cset
. $\endgroup$