On today's Smalltalk Daily, we take a look at the package NumericCollections from the Public Store Repository. Here's part of the package comment for context:
NumericCollections adds the four basic numeric methods (+, -, *, /) to collections as well as some other methods that come as a natural follow on.
Collections can be sent any of the four basic math messages. And you can make collections be the arguments too. Some examples:
#(1 2 3 4) + #(5 6 7 8) --> #(6 8 10 12)
(Bag with: 2 with: 2 with: 6) / -2 --> Bag (-3 -1 -1)
Well worth looking at and playing with for ideas - and a neat extension to the system.
Technorati Tags:
smalltalk, numerics