Trans
9/2/2006 7:34:00 PM
Trans wrote:
> [ "a", "a", "b", "c" ].contrast => [ nil, nil, "b", nil ]
> [ "a", "a", "b", "c" ].ordered_contrast => [ nil, nil, "b","c" ]
>
> [ "a", "a", "b", "c" ].intersect => [ "a", "a", nil, "c" ]
> [ "a", "a", "b", "c" ].ordered_intersect => [ "a", "a", nil, nil ]
Opps... I forgot the comparision array and screwed it up. Let me try
that again:
[ "a", "a", "b", "c" ].contrast([ "a", "a", "c", "c" ]) => [ nil,
nil, "c", nil ]
[ "a", "a", "b", "c" ].ordered_contrast([ "a", "a", "c", "c" ]) => [
nil, nil, "c","c" ]
In these the difference being show is that of the parameter's. If we
swap the receiver and the parameter:
[ "a", "a", "c", "c" ].contrast([ "a", "a", "b", "c" ]) => [ nil,
nil, "b", nil ]
[ "a", "a", "c", "c" ].ordered_contrast([ "a", "a", "b", "c" ]) => [
nil, nil, "b","c" ]
And of course the inverse:
[ "a", "a", "b", "c" ].intersect([ "a", "a", "c", "c" ]) => [ "a",
"a", nil, "c" ]
[ "a", "a", "b", "c" ].ordered_intersect([ "a", "a", "c", "c" ]) =>
[ "a", "a", nil, nil ]
Also interesting:
[ "a", "a", "b", "c" ].contrast([ "a", "a", "c", "c" ]) => [ nil,
nil, "c", nil ]
[ nil, nil, "c", nil ].contrast([ "a", "a", "c", "c" ]) => [ "a",
"a", nil, "c" ]
which is the intersection.
T.