KEGGeneratorBase

SqueakSource3 project page

KEGGenerators is a library that implements Smalltalk Generators like those found in the book A Little Smalltalk. It is well documented in the Package and Class and Method comments. The main documentation is in the KEGGeneratorBasePackageComment Class comment and in the KEGGenerator Class comment and in the KEGOnableGenerator Class comment. Also the public Methods in the KEGGenerator Class all have long comments. There are 131 TestCase(s) which you can find in the test runner by looking for the KEGTestCaseObject Class and selecting all of its subClasses to run the tests. These tests are designed to show lots of examples of how to get the basic functionality of each generator Method to work. They show basic one line examples of each Method but they don`t really give a flavor of how KEGGenerators are used in practice. Generators are like abstracted Collections and Streams. A KEGGenerator is an abstracted sequence of Objects. There is a great flexibility provided by this abstraction. Basically they are sequences that respond to the >>reset and >>next messages. Also Generators allow you to reduce the number of intermediate Collections you have to allocate during a Collection iteration calculation to zero. You take a Collection and build a KEGGenerator on top of it and then iterate the generator to produce a new Collection but without allocating any intermediate Collections. If your Collections are large this can save you space and time. KEGGenerators should work well with Xtreams. KEGGenerators can be on Collections and Streams and any sequence of Objects. In other words they abstract Collections and Streams to a higher level. KEGGenerators can act like Collections or Streams in many ways. When you start using KEGGenerators you will use them extensively in place of Collections and Streams to do calculations and manipulations. KEGGenerators are lazy. They only iterate if you send them an iteration message like >>asArray or >>iterate or >>do: or >>inject:into: etc. You can build up KEGGenerators using all the public methods in the KEGGenerator Class. There are numerous >>asGenerator Methods that show how you can turn any Object into a sequence of Objects like Date>>asGenerator which produces an infinite sequence of Dates for example. Once a KEGGenerator sequence has been created then you can use all of the public Methods in the KEGGenerator Class to create new KEGGenerators on top of it. Once your KEGGenerator is created then you can iterate it to get it to produce a new Collection or side effects or etc. Building a KEGGenerator creates a linked list of KEGGenerators but the list structure is hidden. It is like a pipeline of KEGGenerators each one feeding into the next. The last KEGGenerator in the hidden list is the >>headwaters generator. This headwaters Generator can be switched out such that you can build a KEGGenerator once and then reuse it with different headwaters Collections or Streams or KEGGenerators so you don`t have to keep rebuilding the same KEGGenerator over and over again. Here is how you load the KEGGenerator Packages into a virgin image. First you open the Monticello browser. Hit the +Repository button. Select HTTP. Below on this webpage see the Monticello Registration. Click on it and copy the text String. Right click copy. Paste the String into the Monticello dialog. Click OK. A new Repository browser will open. In the left pane click on the ConfigurationOfKEGGeneratorBase Package .mcz file with the highest version number. I believe it is ConfigurationOfKEGGeneratorBase-KjellGodo.8.mcz. Click the Load button. It should load. Now open a Workspace. and evaluate the following to exclude the testing Packages : ( ( ConfigurationOfKEGGeneratorBase project version: '1.0' ) load ). Now to include the testing Packages evaluate the following : ( ( ConfigurationOfKEGGeneratorBase project version: '1.0' ) load: 'Tests' ) I hope you will give KEGGenerators a try. Once you start using them you will find that they are way better than Collections or Streams alone. And you may find that you make your own public methods in the KEGGenerator Class that other people can also use. Contact me at picoVerse att gMail dott com. There is a google group for this library at https://groups.google.com/forum/?hl=en&fromgroups=#!forum/keggenerators . KEGGenerators now work with Pharo 2.0.

ConfigurationOfKEGGeneratorBase-KjellGodo.15.mcz
KEGGeneratorBaseTest-KjellGodo.9.mcz
ConfigurationOfKEGGeneratorBase-KjellGodo.13.mcz
KEGGeneratorBaseTest-KjellGodo.8.mcz
KEGGeneratorBase-KjellGodo.11.mcz
ConfigurationOfKEGGeneratorBase-KjellGodo.8.mcz
ConfigurationOfKEGGeneratorBase-KjellGodo.7.mcz
KEGGeneratorBase-KjellGodo.10.mcz
KEGGeneratorBaseTest-KjellGodo.7.mcz
ConfigurationOfKEGGeneratorBase-KjellGodo.6.mcz
ConfigurationOfKEGGeneratorBase-KjellGodo.5.mcz
ConfigurationOfKEGGeneratorBase-KjellGodo.4.mcz
ConfigurationOfKEGGeneratorBase-KjellGodo.3.mcz
ConfigurationOfKEGGeneratorBase-KjellGodo.2.mcz
KEGGeneratorPost001FakeNewTest-KjellGodo.2.mcz
KEGGeneratorPost001FakeNew-KjellGodo.4.mcz
KEGGeneratorBaseTest-KjellGodo.6.mcz
KEGGeneratorBase-KjellGodo.9.mcz