:merge => :union and Array#uniq!

7 views
Skip to first unread message

John Mettraux

unread,
Jul 8, 2011, 7:35:33 PM7/8/11
to ruote
Hello List,

I just saw an interesting commit at

https://github.com/xaop/ruote/commit/8ca1662ae23bc8f2f836f1fd3fc6dabfe74ffc4c

Julien has a point, 'union', most of the time, evokes union of sets, so he removed duplicates from merged array.

Now I think the extra parameter 'uniq_on_union_array' is a bit long. I'd suggest splitting 'union' into 'union' and 'concat', where 'union' is the default as seen by Julien (uniq! applied) and 'concat' reproduces the current behaviour (pre-Julien).

The commit misses a test for :uniq_on_union_array => false.


Wdyt ?

--
John Mettraux - http://jmettraux.wordpress.com

John Mettraux

unread,
Jul 17, 2011, 7:47:25 AM7/17/11
to ruote
2011/7/9 John Mettraux <jmet...@gmail.com>:

>
>  https://github.com/xaop/ruote/commit/8ca1662ae23bc8f2f836f1fd3fc6dabfe74ffc4c
>
> Julien has a point, 'union', most of the time, evokes union of sets, so he removed duplicates from merged array.
>
> Now I think the extra parameter 'uniq_on_union_array' is a bit long. I'd suggest splitting 'union' into 'union' and 'concat', where 'union' is the default as seen by Julien (uniq! applied) and 'concat' reproduces the current behaviour (pre-Julien).

Pushed

https://github.com/jmettraux/ruote/commit/cbc6b46c92a3c4492b99f02621946556fb16aee2

Many thanks to Julien France.

Reply all
Reply to author
Forward
0 new messages