Issue 3527 in pharo: Please add the following Generator code to Pharo. I need it to port a package I am writing from Squeak to Pharo

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

Issue 3527 in pharo: Please add the following Generator code to Pharo. I need it to port a package I am writing from Squeak to Pharo

pharo
Status: New
Owner: ----

New issue 3527 by rpboland: Please add the following Generator code to  
Pharo.  I need it to port a package I am writing from Squeak to Pharo
http://code.google.com/p/pharo/issues/detail?id=3527

Squeak 4.1 has a class Generator which I use for a package I am developing  
for Squeak and would also like to port to Pharo.
But Pharo doesn't have this class.
I propose that this class (and class GeneratorTest) be ported to Pharo.
I have attached the two .st files that need to be filed in.
I have loaded them into Pharo1.1 and it appears to work.
Note that since the code is in Squeak 4.1 it is MIT.

I have also signed the Pharo code release form though you would
really need the release form signed by Andreas Rass if that
is an issue.

The generators code was added to Squeak by Andreas Raas.
The class Generator can be found in Squeak as a subclass
of Stream.  It's about 140 lines of code and, as I said before,
is really useful.
Class Generator is tested in class GeneratorTest which also serves
as examples of uses of Generators.
The following text is from the Generator class comment:

"
A Generator transforms callback interfaces into stream interfaces.

When a producer algorithm provide results as callbacks (blocks) and a
consumer algorithm expects streamable input, a Generator transforms
one into the other, for example:

        | generator |
        generator := Generator on: [:g| Integer primesUpTo: 100 do:[:prime| g
yield: prime]].
        [generator atEnd] whileFalse:[Transcript show: generator next].
"

Try it.  You'll like it.

Regards,

Ralph Boland

Attachments:
        GeneratorTest.st  4.7 KB


Reply | Threaded
Open this post in threaded view
|

Re: Issue 3527 in pharo: Please add the following Generator code to Pharo. I need it to port a package I am writing from Squeak to Pharo

pharo

Comment #1 on issue 3527 by [hidden email]: Please add the following  
Generator code to Pharo.  I need it to port a package I am writing from  
Squeak to Pharo
http://code.google.com/p/pharo/issues/detail?id=3527

can you attach code (not only a test)?


Reply | Threaded
Open this post in threaded view
|

Re: Issue 3527 in pharo: Please add the following Generator code to Pharo. I need it to port a package I am writing from Squeak to Pharo

pharo

Comment #2 on issue 3527 by [hidden email]: Please add the following  
Generator code to Pharo.  I need it to port a package I am writing from  
Squeak to Pharo
http://code.google.com/p/pharo/issues/detail?id=3527

I thought I had attached two files.  Be that as it may
I have attached the generator file again below


Attachments:
        Generator.st  3.7 KB


Reply | Threaded
Open this post in threaded view
|

Re: Issue 3527 in pharo: Please add the following Generator code to Pharo. I need it to port a package I am writing from Squeak to Pharo

pharo
Updates:
        Status: Fixed
        Labels: Milestone-1.3

Comment #3 on issue 3527 by [hidden email]: Please add the following  
Generator code to Pharo.  I need it to port a package I am writing from  
Squeak to Pharo
http://code.google.com/p/pharo/issues/detail?id=3527

(No comment was entered for this change.)


Reply | Threaded
Open this post in threaded view
|

Re: Issue 3527 in pharo: Please add the following Generator code to Pharo. I need it to port a package I am writing from Squeak to Pharo

pharo
Updates:
        Status: Closed

Comment #4 on issue 3527 by [hidden email]: Please add the following  
Generator code to Pharo.  I need it to port a package I am writing from  
Squeak to Pharo
http://code.google.com/p/pharo/issues/detail?id=3527

in 13009