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

14 lines
348 B
Groovy
Raw Permalink Normal View History

2014-01-17 05:32:22 +00:00
[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()
}