RosettaCodeData/Task/Multiple-distinct-objects/Groovy/multiple-distinct-objects-3...

14 lines
348 B
Groovy

[createFoos1, createFoos2].each { createFoos ->
print "Objects distinct for n = "
(2..<20).each { n ->
def foos = createFoos(n)
foos.eachWithIndex { here, i ->
foos.eachWithIndex { there, j ->
assert (here == there) == (i == j)
}
}
print "${n} "
}
println()
}