Generators for Pharo Xmax wish)

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

Generators for Pharo Xmax wish)

Ralph Boland
I earlier posted a Xmas wish that Pharo add generators
(steal the generators code from Squeak).
No one appeared to be familiar with them.
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 and needed in order for me to port some of the
packages I am developing from Squeak to Pharo.
Class Generator is tested in class GeneratorTest which also serves
as examples of uses of Generators.
So please, someone go steal the code!
And stealing is easy.  For example I stole the following comment on
class Generator directly from the 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].
"

Regards,

Ralph Boland

Reply | Threaded
Open this post in threaded view
|

Re: Generators for Pharo Xmax wish)

Miguel Cobá
The easiest way to get this code into pharo core is to create a mcz
package, put it on PharoInbox on squeaksource and create a ticket in
code.google.com/p/pharo referencing it and taggint it Fixed, this way
Stéphane or Markus can harvest it to the core image.
If the mcz package is overkill, then a simple fileout of the package in
squeak attached to the ticket will do.

Maybe in the long term a project on squeaksource should be created (if
not exists) and new changes to to it and from there pulled to squeak and
pharo.

Cheers

El mar, 04-01-2011 a las 15:43 -0700, Ralph Boland escribió:

> I earlier posted a Xmas wish that Pharo add generators
> (steal the generators code from Squeak).
> No one appeared to be familiar with them.
> 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 and needed in order for me to port some of the
> packages I am developing from Squeak to Pharo.
> Class Generator is tested in class GeneratorTest which also serves
> as examples of uses of Generators.
> So please, someone go steal the code!
> And stealing is easy.  For example I stole the following comment on
> class Generator directly from the 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].
> "
>
> Regards,
>
> Ralph Boland
>

--
Miguel Cobá
http://twitter.com/MiguelCobaMtz
http://miguel.leugim.com.mx




Reply | Threaded
Open this post in threaded view
|

Re: Generators for Pharo Xmax wish)

Noury Bouraqadi-2
Hi,

Before integrating some code into Pharo the first step is to check that the licence is MIT.

Noury
On 5 janv. 2011, at 00:22, Miguel Cobá wrote:

> The easiest way to get this code into pharo core is to create a mcz
> package, put it on PharoInbox on squeaksource and create a ticket in
> code.google.com/p/pharo referencing it and taggint it Fixed, this way
> Stéphane or Markus can harvest it to the core image.
> If the mcz package is overkill, then a simple fileout of the package in
> squeak attached to the ticket will do.
>
> Maybe in the long term a project on squeaksource should be created (if
> not exists) and new changes to to it and from there pulled to squeak and
> pharo.
>
> Cheers
>
> El mar, 04-01-2011 a las 15:43 -0700, Ralph Boland escribió:
>> I earlier posted a Xmas wish that Pharo add generators
>> (steal the generators code from Squeak).
>> No one appeared to be familiar with them.
>> 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 and needed in order for me to port some of the
>> packages I am developing from Squeak to Pharo.
>> Class Generator is tested in class GeneratorTest which also serves
>> as examples of uses of Generators.
>> So please, someone go steal the code!
>> And stealing is easy.  For example I stole the following comment on
>> class Generator directly from the 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].
>> "
>>
>> Regards,
>>
>> Ralph Boland
>>
>
> --
> Miguel Cobá
> http://twitter.com/MiguelCobaMtz
> http://miguel.leugim.com.mx
>
>
>
>


Reply | Threaded
Open this post in threaded view
|

Re: Generators for Pharo Xmax wish)

Stéphane Ducasse
In reply to this post by Ralph Boland

On Jan 4, 2011, at 11:43 PM, Ralph Boland wrote:

> I earlier posted a Xmas wish that Pharo add generators
> (steal the generators code from Squeak).
> No one appeared to be familiar with them.
> 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 and needed in order for me to port some of the
> packages I am developing from Squeak to Pharo.
> Class Generator is tested in class GeneratorTest which also serves
> as examples of uses of Generators.
> So please, someone go steal the code!

Ralph please package it, open ticket, so that we have tracability.


> And stealing is easy.

We are not stealing we are reusing. And Generator are probably coming from GNU Smalltalk.


>  For example I stole the following comment on
> class Generator directly from the 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].
> "
>
> Regards,
>
> Ralph Boland
>


Reply | Threaded
Open this post in threaded view
|

Re: Generators for Pharo Xmax wish)

Stéphane Ducasse
In reply to this post by Noury Bouraqadi-2

On Jan 5, 2011, at 8:55 AM, Noury Bouraqadi wrote:

> Hi,
>
> Before integrating some code into Pharo the first step is to check that the licence is MIT.

from Squeak it is since they publish in MIT.
Having tests and class comments would be a good check.

>
> Noury
> On 5 janv. 2011, at 00:22, Miguel Cobá wrote:
>
>> The easiest way to get this code into pharo core is to create a mcz
>> package, put it on PharoInbox on squeaksource and create a ticket in
>> code.google.com/p/pharo referencing it and taggint it Fixed, this way
>> Stéphane or Markus can harvest it to the core image.
>> If the mcz package is overkill, then a simple fileout of the package in
>> squeak attached to the ticket will do.
>>
>> Maybe in the long term a project on squeaksource should be created (if
>> not exists) and new changes to to it and from there pulled to squeak and
>> pharo.
>>
>> Cheers
>>
>> El mar, 04-01-2011 a las 15:43 -0700, Ralph Boland escribió:
>>> I earlier posted a Xmas wish that Pharo add generators
>>> (steal the generators code from Squeak).
>>> No one appeared to be familiar with them.
>>> 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 and needed in order for me to port some of the
>>> packages I am developing from Squeak to Pharo.
>>> Class Generator is tested in class GeneratorTest which also serves
>>> as examples of uses of Generators.
>>> So please, someone go steal the code!
>>> And stealing is easy.  For example I stole the following comment on
>>> class Generator directly from the 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].
>>> "
>>>
>>> Regards,
>>>
>>> Ralph Boland
>>>
>>
>> --
>> Miguel Cobá
>> http://twitter.com/MiguelCobaMtz
>> http://miguel.leugim.com.mx
>>
>>
>>
>>
>
>