Porting Transducers to Pharo

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

Re: Porting Transducers to Pharo

Esteban A. Maringolo
Hi Steffen,

2017-06-06 7:44 GMT-03:00 Steffen Märcker <[hidden email]>:
> I assumed so. I used file-outs only to get something working quickly. =)
> Properly published code will follow as soon as I am more familiar with code
> management in Pharo.

I'm coming back to this. What was the choosen tool? I tried
FileOuterNG but it doesn't work in VW PUL 8.2, and I don't understand
the reasoning behind the "bindings" mappings (it fails when building
the default mappings).

The FileOut30 package doesn't seem to respect encodings at all.

Thanks!

Esteban A. Maringolo

Reply | Threaded
Open this post in threaded view
|

Re: Porting Transducers to Pharo

Damien Pollet-2
I think I used FileOut30 and encodings were part of the adhoc fixing before loading into Pharo (using iconv certainly, but I don't recall)

On 21 March 2018 at 14:29, Esteban A. Maringolo <[hidden email]> wrote:
Hi Steffen,

2017-06-06 7:44 GMT-03:00 Steffen Märcker <[hidden email]>:
> I assumed so. I used file-outs only to get something working quickly. =)
> Properly published code will follow as soon as I am more familiar with code
> management in Pharo.

I'm coming back to this. What was the choosen tool? I tried
FileOuterNG but it doesn't work in VW PUL 8.2, and I don't understand
the reasoning behind the "bindings" mappings (it fails when building
the default mappings).

The FileOut30 package doesn't seem to respect encodings at all.

Thanks!

Esteban A. Maringolo


Reply | Threaded
Open this post in threaded view
|

Re: Porting Transducers to Pharo

Clément Béra
In reply to this post by Steffen Märcker


On Fri, Jun 2, 2017, 17:05 Steffen Märcker <[hidden email]> wrote:
Dear all,

thanks for the many suggestions. I didn't had time to test all import/export ways yet. But for now, I can report on two:

1) NGFileOuter
Unfortunately It raised several MNUs in my image. I'll investigate them later.

2) FileOut30 (VW Contributed)
I was able to file out the code except for the package definition. Replacing {category: ''} in the class definitions with {package: 'Transducers'} fixed that. However, methods that extend existing classes did not end up in the Transducers package. Is there a similar easy change to the file-out making that happen? Also I'd like to add the package comment if that's possible.

Most things appear to work as far as I can see. Two exceptions:
1) Random is a subclass of Stream in VW and in Pharo it is not. Hence, I'll have to copy some methods from Stream to Random.
2) I used #beImmutable in VW but I couldn't yet figure out how to make objects immutable in Pharo.

#beReadOnlyObject. Pharo 6.1 and onwards.
#beWritable to revert.


However, until the tests are ported, I cannot guarantee. Porting the test suite will be another beast, since I rely on the excellent mocking/stubbing library DoubleAgents by Randy Coulman. I am not sure how I will handle that. In general, I think it would be really worth the effort to be ported to Pharo, too. DoubleAgents is pretty powerful and produces easy to read and understand mocking/stubbing code. Personally, I prefer it clearly, e.g., over Mocketry (no offence intended!).

Attached you'll find the file-out that I loaded into Pharo. The issues above are not addressed yet. However, the following example works:

| scale sides count collect experiment random samples coin flip |

scale := [:x | (x * 2 + 1) floor] map.
sides := #(heads tails) replace.
count := 1000 take.

collect := [:bag :c | bag add: c; yourself].
experiment := (scale * sides * count) transform: collect.
random := #(0.1 0.3 0.4 0.5 0.6 0.7 0.8 0.9).

samples := random

              reduce: experiment
              init: Bag new.

samples := random

              transduce: scale * sides * count
              reduce: collect
              init: Bag new.

coin := sides <~ scale <~ random.

flip := Bag <~ count.

samples := flip <~ coin.


Best, Steffen



Am .06.2017, 08:16 Uhr, schrieb Stephane Ducasse <[hidden email]>:

There is a package for that NGFileOuter or something like that on cincom
store.
We used it for mobydic code.

On Wed, May 31, 2017 at 6:35 PM, Alexandre Bergel <[hidden email]>
wrote:

If I remember correctly, there is a parcel in VisualWorks to export a file
out (Squeak format).

@Milton, can you give a hand to Steffen?

Alexandre
--
_,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:
Alexandre Bergel  http://www.bergel.eu
^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;.



On May 31, 2017, at 10:32 AM, Steffen Märcker <[hidden email]> wrote:

Thanks for the encouraging response! First question: Which is the
recommended (friction free) way to exchange code between VW and Pharo?

Cheers!
Steffen

Am .05.2017, 16:22 Uhr, schrieb Alexandre Bergel <[hidden email]
>:

I second Sven. This is very exciting!

Let us know when you have something ready to be tested.

Alexandre




Reply | Threaded
Open this post in threaded view
|

Re: Porting Transducers to Pharo

Stephane Ducasse-3
In reply to this post by Esteban A. Maringolo
Hi esteban

It was to manage namespace (from memory).

Stef

On Wed, Mar 21, 2018 at 2:29 PM, Esteban A. Maringolo
<[hidden email]> wrote:

> Hi Steffen,
>
> 2017-06-06 7:44 GMT-03:00 Steffen Märcker <[hidden email]>:
>> I assumed so. I used file-outs only to get something working quickly. =)
>> Properly published code will follow as soon as I am more familiar with code
>> management in Pharo.
>
> I'm coming back to this. What was the choosen tool? I tried
> FileOuterNG but it doesn't work in VW PUL 8.2, and I don't understand
> the reasoning behind the "bindings" mappings (it fails when building
> the default mappings).
>
> The FileOut30 package doesn't seem to respect encodings at all.
>
> Thanks!
>
> Esteban A. Maringolo
>

123