new files
This commit is contained in:
parent
3af7344581
commit
86c034bb8b
1364 changed files with 21352 additions and 0 deletions
17
Task/Ordered-words/Smalltalk/ordered-words.st
Normal file
17
Task/Ordered-words/Smalltalk/ordered-words.st
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
|file dict r t|
|
||||
file := FileStream open: 'unixdict.txt' mode: FileStream read.
|
||||
dict := Set new.
|
||||
|
||||
"load the whole dict into the set before, 'filter' later"
|
||||
[ file atEnd ] whileFalse: [
|
||||
dict add: (file upTo: Character nl) ].
|
||||
|
||||
"find those with the sorted letters, and sort them by length"
|
||||
r := ((dict
|
||||
select: [ :w | (w asOrderedCollection sort) = (w asOrderedCollection) ] )
|
||||
asSortedCollection: [:a :b| (a size) > (b size) ] ).
|
||||
|
||||
"get those that have length = to the max length, and sort alphabetically"
|
||||
r := (r select: [:w| (w size) = ((r at: 1) size)]) asSortedCollection.
|
||||
|
||||
r do: [:e| e displayNl].
|
||||
Loading…
Add table
Add a link
Reference in a new issue