Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

⍵[9] INDEX ERRORs on the shorter words, and that code needs a compress to do the filtering. It's a more traditional and faster approach, which is better from those viewpoints. If faster and avoiding each and using array concepts is desirable, how about:

    words←↑⊃⎕nget 'wordlist.txt' 1 
    tenK←words⌿⍨('k'=words[;9])∧(' '≠words[;10])∧(' '=words[;11])
    tenK⌿⍨{∧/1='abc'(+/∘.∊)⍵}⍤1⊢tenK
Mix ↑ turns the nested wordlist into a 2D array by padding short strings out to the length of the longest using spaces, which I don't like but am (ab)using here to tell when the words end.


Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: