From: Robert Klemme Date: 2003-04-08T17:33:20+09:00 Subject: Re: Array Sutraction "Jim Freeze" schrieb im Newsbeitrag news:20030408003523.A678@freeze.org... > I'm sorry Matz, I don't understand. > > I don't have a horse in either the set or bag race. > It's just the current implementation is very confusing. > > If I have a = [1,1,2,2,2] and I subtract [2], then > I should get [1,1,2,2] if a is considered a bag. > If a is considered a set, then it must first be > temporarily converted to a set [1,2] and then > the subtraction is performed yielding [1]. I don't find this confusing. In fact I find the implicit application of uniq (older version) more confusing because it is somewhat surprising - at least to me. In that case substraction indeed combines two operations. I'd view the substraction "a-b" as "remove all elements in b from a", which would reasonable lead to all 2's removed from [1,1,2,2,2] yielding [1,1]. > However, 1.8.0 returns [1,1]. > > ruby -ve 'p [1,1,2,2,2]-[2]' > ruby 1.8.0 (2003-03-10) [i386-freebsd4.6] > [1, 1] That's what I'd expect. robert