sumim #7076(2008/08/09 11:28 GMT) [ Smalltalk ] Rating1/1=1.00
Squeak Smalltalk で。
1 2 3 4 5 6 7 8 9 10 11 12
| dict stream delimiters lineCount | dict := Dictionary new. stream := HTTPSocket httpGet: 'http://www.gnu.org/licenses/gpl.txt'. delimiters := Character allCharacters reject: [:each | each isLetter]. lineCount := 0. [stream atEnd] whileFalse: [ lineCount := lineCount + 1. ((stream upTo: Character lf) subStrings: delimiters) do: [:word | | lines | lines := dict at: word ifAbsentPut: [OrderedCollection new]. lines add: lineCount]]. ^dict
Rating1/1=1.00-0+
[ reply ]
sumim
#7076()
[
Smalltalk
]
Rating1/1=1.00
Squeak Smalltalk で。
| dict stream delimiters lineCount | dict := Dictionary new. stream := HTTPSocket httpGet: 'http://www.gnu.org/licenses/gpl.txt'. delimiters := Character allCharacters reject: [:each | each isLetter]. lineCount := 0. [stream atEnd] whileFalse: [ lineCount := lineCount + 1. ((stream upTo: Character lf) subStrings: delimiters) do: [:word | | lines | lines := dict at: word ifAbsentPut: [OrderedCollection new]. lines add: lineCount]]. ^dictRating1/1=1.00-0+
[ reply ]