Hello
A simple example :
data = {a, b, c, d};
{15, With[{k = c}, Flatten[Position[data, k]]]} (* output {15,{3}} *)
To remove the brackets around 3 I found no other way than:
{15, With[{k = c}, Flatten[Position[data, k]]] /. {a_} -> a} (* output {15,3} *)
Are there better ways to get this result? The most frequent use I have for this construction is to get iterators values for Sum
or Product
that are returned by various functions and of course they are always between brackets.
Thanks