Using Go 1.11 I have 5 group of three numbers each in their own slice. I want to be able to compare that to a core data set.
Example data
My Groups: [[1 2 3] [4 9 2] [7 9 3] [4 7 5] [4 3 2]]
My Core Data: [5 9 7 3 2]
So I want to be able to match my core data up with any of the groups. As the example data shows, the core data does have 9, 7 and 3 so it should match the 3rd group.
But each time I try to loop, I am not getting the logic right.
Any help most welcome.
UPDATE
So this is the code I am currently working with
groupData := [][]int{{1,2,3}, {7,8,9}, {9,7,3}}
coreData := []int{5,9,7,3,2}
for _, data := range groupData {
fmt.Println( data )
fmt.Println( groupData )
fmt.Println( reflect.DeepEqual(data, coreData) )
}
This returns false all the time. Even on the last set of data 9,7,3
which you can see is contained within the codeData
var.
But even if I had a coreData
like []int{3,2,7,1,9}
that should still result in true, as it still has 3,7,9 and I want to it match that last group.
Hope that explains what I am looking to do more. Thanks.