RosettaCodeData/Task/Multiple-distinct-objects/Groovy/multiple-distinct-objects-3.groovy
2014-01-17 05:34:36 +00:00

13 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()
}