I have list given by:
d=
{{{1,2},{1,1},{2,3}},
{{1,4},{3,3},{2,1}},
{{1,1},{3,1},{3,3}}}
Each row in the list is a different generation of the list. I'm trying to figure out how to look at each iteration and see if any of the elements in each sublist are the same number, e.g. in generation "1" the middle sublist would fit this criteria since it's {1,1}. I have an If statement that finds out this information for a singular row:
m = 1;
tt=Table[
If[
d[[m, l]][[1]] == d[[m, l]][[2]],
Print["Same"],
Print["Different"]],
{l, 1, Length[d[[1]]]}];
I would like to loop the "If" statement above so that it looks at all generations not just generation 1 in list "d." I then want to go through each table given by "tt" and find the number of times "Same" is printed, for each separate generation. Using Length[tt] doesn't distinguish between the two printed words so I'm not sure what control I need to add to have the number of only same printed. I've tried to use a For loop on the If statement to get it to perform the desired function but I know it's best to avoid usage of that. Any help would be appreciated.
Count[#, v_?VectorQ /; Signature[v] == 0] & /@ {{{1, 2}, {1, 1}, {2, 3}}, {{1, 4}, {3, 3}, {2, 1}}, {{1, 1}, {3, 1}, {3, 3}}}Is this something you want? – J. M.'s missing motivation Apr 21 '20 at 01:00Signatureto check whether all the elements are the same! – Victor K. Apr 21 '20 at 01:03Signature[]will catch something like{1, 1, 2}, which might be what you don't want.) – J. M.'s missing motivation Apr 21 '20 at 01:21