sets.extras: rename duplicates-by to unique-by, hah.

char-rename
John Benediktsson 2016-11-18 07:10:50 -08:00
parent fd5aa1d4f2
commit 23c16dea69
2 changed files with 2 additions and 2 deletions

View File

@ -25,4 +25,4 @@ IN: sets.extras.tests
{ HS{ 0 10 20 30 40 } } [ 5 iota [ 10 * ] mapped-set ] unit-test { HS{ 0 10 20 30 40 } } [ 5 iota [ 10 * ] mapped-set ] unit-test
{ { 1 2 4 } } [ { 1 2 3 4 5 } [ 2/ ] duplicates-by ] unit-test { { 1 2 4 } } [ { 1 2 3 4 5 } [ 2/ ] unique-by ] unit-test

View File

@ -35,5 +35,5 @@ IN: sets.extras
'[ @ _ adjoin ] each '[ @ _ adjoin ] each
] keep ; inline ] keep ; inline
: duplicates-by ( seq quot: ( elt -- key ) -- seq' ) : unique-by ( seq quot: ( elt -- key ) -- seq' )
over length <hash-set> '[ @ _ ?adjoin ] filter ; inline over length <hash-set> '[ @ _ ?adjoin ] filter ; inline