アーロ・ガスリーの「アリスのレストラン」の歌詞にインスパイアされて Smalltalk-80 から使われ始めたとされる collect: 、select: 、inject:into: など Ruby で言うところの Smalltalk 由来の 〜ect系のメソッド名(Smalltalk では「メッセージセレクター」あるいは単に「セレクター」)ですが、そういえば当該歌詞にも登場する inspect も広い意味では 〜ect系と考えてよさそうだな、他にも何かないのかな…とふと気になったので、まだ知らない便利な 〜ect:系セレクターの発見もあるかも!と改めて調べてみました。
結果としては、既に把握している collect:、select:、reject:、detect:、inject:into: とその変種の他には目新しいものは見つからなかったわけですが(当然と言えば当然か…)、せっかくなので使った式と結果をメモとして下に残しておきます。^^;
余談ですが、件の歌詞には inject、inspect、detect、select、inspect は登場するものの、collect や reject は見当たらない(では、後者はさておき collect: はどこから?)のもちょっとだけ気になります。
▼ コレクションクラスで使われている ect: を含むセレクター群
(Array streamContents: [:ss | (Collection withAllSubclasses remove: Matrix; yourself) do: [:class | ss nextPutAll: ( class selectors select: [:sel | (sel includesSubString: 'ect:') and: [(sel asLowercase includesSubString: 'object') not]]) ] ]) asSet
Matrix はちょっと特殊なので除きました。
"=> a Set(#collect:thenSelect: #collect:from:to: #pairsCollect: #collect:into: #select:thenCollect: #collect: #detect:ifNone: #overlappingPairsCollect: #groupsOf:atATimeCollect: #inject:into: #select:thenDo: #withIndexCollect: #select: #collect:as: #detect:ifFound:ifNone: #collect:thenDo: #traitsCollect: #valuesCollect: #reject: #detect: #associationsSelect: #with:collect: #reject:thenDo: #regex:matchesCollect:) "
▼ 〜ect 的なセレクターには他にどんなものがあるのか?
(Array streamContents: [:ss | SystemNavigation default allBehaviorsDo: [:class | ss nextPutAll: ( class selectors select: [:sel | (sel includesSubString: 'ect') and: [#(object project rect expect aspect effect connect intersect perfect subject selection ector section defect dissect infect protect dialect collect select inject reject detect) noneSatisfy: [:NG | sel asLowercase includesSubString: NG]] ]) ] ]) asSet
コレクションの〜ect系と、ectを含む単語を除いて集計してみましたが、実質 inpect しか見つかりませんでした。
"=> a Set(#inspectIt: #inspectPointers #inspectCurrentStack #inspectOwnerChain #test06InspectIt #inspect: #inspectForm #inspectCurrentBackground #inspectInstances #inspectOnCount: #inspectModel #inspectIt #inspectProcess #inspectCurrentCard #basicInspect: #inspectWorkingCopy #inspectMethod #inspectArgumentsPlayerInMorphic: #basicInspect #inspect #inspectWorldModel #inspectInMorphic: #inspectViewee #inspectWithLabel: #inspectUntilCount: #inspectAt:event: #inspectOnce #inspectChangeSet #inspect:label: #inspectParameters #inspectInMorphic #inspectTestVars #inspectBasic #inspectContext #inspectSubInstances #inspectReceiver #inspectFirstSubView #inspectAllInstances #smallInspectItIconContents #inspectPreferences #inspectView #inspectKey #inspectElement #inspectFormDictionary #inspectBindings #inspectMember #inspectIt:result: #smallInspectItIcon #doExpiredInspectCount)"