add title sort for use with joe's mp3 player

db4
Doug Coleman 2009-04-03 18:19:45 -05:00
parent ed6da6b18c
commit 73a2fa49c5
3 changed files with 48 additions and 0 deletions

View File

@ -0,0 +1 @@
Doug Coleman

View File

@ -0,0 +1,40 @@
! Copyright (C) 2009 Doug Coleman.
! See http://factorcode.org/license.txt for BSD license.
USING: tools.test sorting.title ;
IN: sorting.title.tests
: sort-me ( -- seq )
{
"The Beatles"
"A river runs through it"
"Another"
"la vida loca"
"Basketball"
"racquetball"
"Los Fujis"
"los Fujis"
"La cucaracha"
"a day to remember"
"of mice and men"
"on belay"
"for the horde"
} ;
[
{
"Another"
"Basketball"
"The Beatles"
"La cucaracha"
"a day to remember"
"for the horde"
"Los Fujis"
"los Fujis"
"of mice and men"
"on belay"
"racquetball"
"A river runs through it"
"la vida loca"
}
] [
sort-me title-sort
] unit-test

View File

@ -0,0 +1,7 @@
! Copyright (C) 2009 Doug Coleman.
! See http://factorcode.org/license.txt for BSD license.
USING: sorting.functor regexp kernel accessors sequences
unicode.case ;
IN: sorting.title
<< "title" [ >lower dup R/ ^(the|a|an|el|la|los|las|il) / first-match [ to>> tail-slice ] when* ] define-sorting >>