25 lines
759 B
Text
25 lines
759 B
Text
import Algorithms as algo;
|
|
import Mathematics as math;
|
|
import Network as net;
|
|
import Text as text;
|
|
|
|
main( argv_ ) {
|
|
url = size( argv_ ) > 1
|
|
? argv_[1]
|
|
: "http://wiki.puzzlers.org/pub/wordlists/unixdict.txt";
|
|
words = algo.materialize( algo.map( net.get( url ).stream, string.strip ), list );
|
|
ordered = algo.materialize(
|
|
algo.filter(
|
|
words,
|
|
@( word ){ word == ∑( algo.map( algo.sorted( word ), string ) ); }
|
|
),
|
|
list
|
|
);
|
|
maxLen = algo.reduce( ordered, @( x, y ){ math.max( x, size( y ) ); }, 0 );
|
|
maxOrderedWords = algo.materialize(
|
|
algo.filter( ordered, @[maxLen]( word ){ size( word ) == maxLen; } ),
|
|
list
|
|
);
|
|
print( "{}\n".format( text.join( algo.sorted( maxOrderedWords ), " " ) ) );
|
|
return ( 0 );
|
|
}
|