rose2 := {{z, 0, 1, 2, 3, 4}, {y, j, k, l, m, 5}, {x, i, b, c, n, 6}, {w, h, a, d, o, 7}, {v, g, f, e, p, 8}, {u, t, s, r, q, 9}};
roseEncode[str_] := Module[{strIn := str, toEn, cLst, rosePos}, toEn := StringCases[ToLowerCase[strIn], RegularExpression["[a-z,0,9]+"]];
cLst := Characters[StringJoin[toEn]];
rosePos := FirstPosition[rose2, #] &/@ cLst];
Return[Partition[rosePos, 2]]; ];
Print["Rose Encode: ", roseEncode["safe"]];
bark := FirstPosition[rose2, #] - 1 & /@ {s, t, a, r, t};
Print["Line Encode: ", bark]
Output: Rose Encode: {{Missing[NotFound],Missing[NotFound]},{Missing[NotFound],Missing[NotFound]}} Line Encode: {{5,2},{5,1},{3,2},{5,3},{5,1}}
The one liner works but the function doesn't. What am I missing? I have printed out cLst in the function and it is {s,t,a,r,t} just like in the one liner, I've tried replacing /@ with Map[rose2,cLst] with the same result. I also tried to Debug but have not figured out how to step through the Map and see each variable. Any help would be appreciated.
Mark
Attachments: