20 lines
674 B
Text
20 lines
674 B
Text
main(params):+
|
|
res =: [] \ to hold the words
|
|
maxw =: 0 \ maximum wordlength
|
|
?# w =: file 'unixdict.txt' give lines
|
|
fault w print stop \ message and stop if error
|
|
? (is ordered w) & w.count >= maxw
|
|
? w.count > maxw \ longer word,
|
|
res =: [] \ reset list
|
|
res[] =: w \ store at next index in list
|
|
maxw =: w.count \ update
|
|
print row res join values by ' '
|
|
|
|
\ check word (w)
|
|
is ordered (w):
|
|
cc =: ' ' \ smallest character
|
|
?# i =: from 1 upto w.count
|
|
? w[i] < cc
|
|
:> ?- \ failed
|
|
cc =: w[i]
|
|
:> ?+
|