Am 10.09.2017 14:45:31 schrieb David T. Lewis <lewis@mail.msen.com>:
On Sun, Sep 10, 2017 at 01:33:15PM +0200, Lorenz K??hl wrote:
> I don't understand why Smalltalk doesn't allow me to have an or:
> method that takes a block argument (except on Boolean). For example:
>
> Set or: 1. ==> MNU as expected.
>
> Set or: [1]. ==> NonBooleanReceiver exception.
>
> Set or: [:x | x] ==> Argument has too many arguments
>
> Is it because the compiler specializes this to boolean when it sees
> the or: [ ... ] syntax? Is this a tradeoff made for performance?
Hi Lorenz,
If you are looking for set operations, check these methods:
Collection>>union:
Collection>>intersection:
Collection>>difference:
I am not sure what you are trying to do with your examples. Can you
explain the intent?
Dave
_______________________________________________
Beginners mailing list
Beginners@lists.squeakfoundation.org
http://lists.squeakfoundation.org/mailman/listinfo/beginners