# P is an array of points, [x,y].# Emit the solution in the form [dist, [P1, P2]]def bruteForceClosestPair(P): (P|length) as $length | if $length < 2 then null else reduce range(0; $length-1) as $i ( null; reduce range($i+1; $length) as $j (.; dist(P[$i]; P[$j]) as $d | if . == null or $d < .[0] then [$d, [ P[$i], P[$j] ] ] e