Ordered words: Difference between revisions

Content added Content deleted
No edit summary
Line 1,941: Line 1,941:
let maxl = foldr max 0 (map length ow)
let maxl = foldr max 0 (map length ow)
print $ filter (\w -> (length w) == maxl) ow</lang>
print $ filter (\w -> (length w) == maxl) ow</lang>

=={{header|Huginn}}==
<lang huginn>import Algorithms as algo;
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 ){ algo.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 );
}</lang>


=={{header|Icon}} and {{header|Unicon}}==
=={{header|Icon}} and {{header|Unicon}}==