Does anyone know why this is happening? When I append to a list using the function below Mathematica is "squaring" each of the elements in the list. When I change to using Append I get the following alternate output "Thread::tdlen: Objects of unequal length in {emptyList,{,,Subframe,-18.47,,5,D}} {emptyList} cannot be combined. >>"
See code below.
thanks
(* Test Function*)
myFunction[aLine_, sf_] := Module[{theList, theSF},
theList = {"emptyList"};
theSF = StringJoin[{"*"}, sf, {","}, {"D"}];
If[StringMatchQ[aLine, theSF], AppendTo[theList, {aLine}]] (*
if aLine contains the sub-string append to the list *)
theList
];
(* Test Case *)
testString = ",,Subframe,-18.47,,5,D";
theResult = myFunction[testString, "5"]
Head[theResult]
theResult[[1]]
Head[theResult[[1]]]
(* Unexpected Output *)
{("emptyList")^2, {(",,Subframe,-18.47,,5,D")^2}}
List
(emptyList)^2
Power
(* Expected Ouput *)
{("emptyList"), {(",,Subframe,-18.47,,5,D")}}