<p>Say I have an array that represents a set of points:</p>

<pre><code>x = [2, 5, 8, 33, 58]
</code></pre>

<p>How do I generate an array of all the pairwise distances? </p>

```
```
x = [2, 5, 8, 33, 58]
print x.collect {|n| x.collect {|i| (n-i).abs}}.flatten
```
```
I think that would do it.