You're going to first need to hold {data1,data2}
unevaluated in some way; either define it first, use SetDelayed
(short form :=
), or use Hold
. I choose :=
.
data1 = {1, 1};
data2 = {2, 2};
datalist := {data1, data2};
Cases[OwnValues[datalist], x_ :> ToString@Unevaluated@x, {3}] // Rest
{"data1", "data2"}
Or using my step
functionmy step
function:
Cases[step[datalist], x_ :> ToString@Unevaluated@x, {2}]
{"data1", "data2"}