Hello,

Here's a maximum word that is more general than longest:

: picker ( quot -- quot ) [ 2dup ] swap append [ 0 > -rot ? ] append ;

: maximum ( seq quot -- item ) >r dup first swap r> picker each ;

{ "a" "ab" "abc" } [ compare-length ] maximum . ! longest

{ 10 20 30 40 } [ <=> ] maximum .                               ! numerical

{ "a" "b" "x" "c" } [ <=> ] maximum .                   ! lexicographical

Oh yeah, how come I just didn't do natural-sort peek ? Space efficiency. 
Shouldn't longest and maximum be a bit more space efficient since sort has to 
create a parallel sequence?

Ed

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk

Reply via email to