RosettaCodeData/Task/Ordered-words/APL/ordered-words.apl

14 lines
512 B
APL
Raw Permalink Normal View History

2019-09-12 10:33:56 -07:00
resultlongest_ordered_words file_path
ffile_path ⎕NTIE 0 ⍝ open file
text⎕NREAD f 'char8' ⍝ read vector of 8bit chars
⎕NUNTIE f ⍝ close file
linestext~text(⎕UCS 10 13) ⍝ split into lines (\r\n)
⍝ filter only words with ordered characters
ordered_wordslines/{()}¨lines
⍝ find max of word lengths, filter only words with that length
resultordered_words/lengths=/lengths¨ordered_words