On Sun, Jan 5, 2020, 15:51 xap <xap@router.33mail.com> wrote:
hi, I'm just starting out w/ pharo and have a question re your code; specifically, in
reject: [ :word | (word sameAs: aWord) or: [ word asLowercase asBag ~= charBag ] ]
is that inner block needed? would it be less smalltalk-esque to write, say:
reject: [ :w | (w = aWord) or: (w asLowercase asBag ~= charBag) ]
thx!
The answer to your question is provided by looking at the definition of the #or: message. Specifically, look on the class Boolean and its subclasses. They should tell you what kinds of objects are allowed for the argument. There is also an #| message which does what you have asked the #or: message to do. Study the differences in their definitions in the Boolean hierarchy.
separately recently I watched an alan kay interview in which he says an oo program is typically much smaller than its imperative counterpart and i wondered why. Well, it seems that reduction comes from the language/system providing a zillion methods -- asBag, here -- one would otherwise need to implement, oneself :)
-- Sent from: http://forum.world.st/Pharo-Smalltalk-Users-f1310670.html