Tobias Reif <tobiasreif / pinkjuice.com> schrieb:
> So here#s what I had

>    def diff other
>      if self.length >= other.length
>        longer  = self.dup
>        shorter = other.dup
>      elsif self.length <= other.length
>        longer  = other.dup
>        shorter = self.dup
>      end
>      shorter.each do |el|
>        if longer.index(el)
>          longer.delete_at longer.index(el)
>        end
>      end
>      longer
>    end

This is shorter:

diff(other)
	u = self | other
	i = self & other
	u == i ? u : u - i
end

I don't know which is faster. You should benchmark both if speed
does matter.

-- 
Don't worry about people stealing an idea. If it's original, you will have to 
ram it down their throats.
  -- Howard Aiken