From: Chris Pine Date: 2003-02-06T06:34:45+09:00 Subject: a cute way to reduce a fraction? Hello, I'm trying to find a pretty way to reduce a fraction. Assuming I have two arrays, `num' and `den', containing the prime factors of the numerator and the denomenator, I'd like some nice way to remove identical numbers and thus reduce the fraction. So it would look like this: num = [2, 2, 3] # 12 den = [2, 3] # 6 # ...your pretty ruby here... num # --> [2] den # --> [] I tried some stuff with each_with_index and deleting from the arrays when I find a match, but deleting elements from an array you are each'ing is not pretty. Every solution I come up with seems to have too much going on. There's got to be a pretty Ruby way to do this, right? Chris