>>438 GNU Smalltalk
| Kim Robin Sandy Lee cats |
Likes members: {
Kim := People named: #Kim.
Robin := People named: #Robin.
Sandy := People named: #Sandy.
Lee := People named: #Lee.
cats := Animals named: #cats
}.
Kim likes: Robin.
Sandy likes: Kim.
Robin likes: cats.
Sandy likes: [:who |
((who isKindOf: People) or: [who isKindOf: Animals]) and: [who definitelyLikes: cats]].
Kim likes: [:who |
(who isKindOf: People) and: [who definitelyLikes: {Lee. Kim}]].
Sandy likes: Lee.
Likes members do: [:who |
((who isKindOf: People) or: [who isKindOf: Animals]) ifTrue: [who likes: who]].
Likes members asArray collect: [:each | (each -> each allOneLikes) printNl]
"=>
Robin->(cats Robin )
cats->(cats )
Kim->(Robin Sandy Kim )
Sandy->(Kim Robin cats Lee Sandy )
Lee->(Lee )
"
http://ideone.com/9Fxawa