Re: [Pharo-users] Rocking Smalltalk

2019-10-23 Thread askoh
Very nice. Thanks.
Where can I get more info on Thales work and the Unreal work?

Aik-Siong Koh



--
Sent from: http://forum.world.st/Pharo-Smalltalk-Users-f1310670.html



Re: [Pharo-users] BlockClosure

2019-10-23 Thread Richard Sargent



On October 23, 2019 5:46:50 AM PDT, "p...@highoctane.be"  
wrote:
>On Wed, 23 Oct 2019, 14:25 Kasper Osterbye, 
>wrote:
>
>> On Wed, Oct 23, 2019 at 2:21 PM p...@highoctane.be
>
>> wrote:
>>
>>> It is like Object>>in: aBlock no?
>>>
>> Yes.
>>
>> But because it is an operator, you can write "obj => block => block
>=>
>> block".
>> You can not write "obj in: block in: block in: block", because
>smalltalk
>> will think it is a selector named "in:in:in:".
>>
>
>Indeed.
>
>I would still use in: with parentheses instead of introducing a new
>(albeit
>cool) operator.

Especially when that particular selector has often been implemented as a 
shorthand for creating associations!


>
>Phil
>
>
>> Best,
>>
>> Kasper
>>



Re: [Pharo-users] [ANN] BitmapCharacterSet moved to GitHub

2019-10-23 Thread Sven Van Caekenberghe



> On 23 Oct 2019, at 17:17, Torsten Bergmann  wrote:
> 
> Hi,
> 
> the STHub -> PharoExtras project "BitmapCharacterSet"
> 
> 1. was now moved from 
> http://smalltalkhub.com/#!/~PharoExtras/BitmapCharacterSet to
>   https://github.com/pharo-contributions/BitmapCharacterSet including the 
> FULL HISTORY
> 
>   The old STHub repo was marked as obsolete - but is linking to the new one
> 
> 2. the test package "Collections-Tests-BitmapCharacterSet" was renamed into 
> "Collections-BitmapCharacterSet-Tests"
> 
> 3. Travis CI job was setup 
> (https://travis-ci.org/pharo-contributions/BitmapCharacterSet) for P7 which 
> is green
> 
> 4. the new version is tagged in git as version 1.2.7.
> 
> 5. the Config was adopted with 1.2.7 and uploaded into MetaRepoForPharo70 so 
> it works in catalog
> 
> 
> You can load "BitmapCharacterSet" in Pharo 7 and 8 from Catalog or via load 
> instructions
> 
>  Metacello new
>   baseline: 'BitmapCharacterSet';
>   repository: 'github://pharo-contributions/BitmapCharacterSet/src';
>   load.
> 
> 
> Side note:
> ==
> This is one of the prerequisites for XML support (which is planned to be 
> moved to github too)
> More to come...

Thanks a lot, Torsten, this is (a) really important (first step).

Looking forward to the full XML Support move.

> Bye
> T.
> 




[Pharo-users] [ANN] BitmapCharacterSet moved to GitHub

2019-10-23 Thread Torsten Bergmann
Hi,

the STHub -> PharoExtras project "BitmapCharacterSet"

1. was now moved from 
http://smalltalkhub.com/#!/~PharoExtras/BitmapCharacterSet to
   https://github.com/pharo-contributions/BitmapCharacterSet including the FULL 
HISTORY

   The old STHub repo was marked as obsolete - but is linking to the new one

2. the test package "Collections-Tests-BitmapCharacterSet" was renamed into 
"Collections-BitmapCharacterSet-Tests"

3. Travis CI job was setup 
(https://travis-ci.org/pharo-contributions/BitmapCharacterSet) for P7 which is 
green

4. the new version is tagged in git as version 1.2.7.

5. the Config was adopted with 1.2.7 and uploaded into MetaRepoForPharo70 so it 
works in catalog


You can load "BitmapCharacterSet" in Pharo 7 and 8 from Catalog or via load 
instructions

  Metacello new
baseline: 'BitmapCharacterSet';
repository: 'github://pharo-contributions/BitmapCharacterSet/src';
load.


Side note:
==
This is one of the prerequisites for XML support (which is planned to be moved 
to github too)
More to come...

Bye
T.



Re: [Pharo-users] BlockClosure

2019-10-23 Thread Richard O'Keefe
No kind of object does what you want.
You cannot do   3 3
or  #x #y
As for [:x | x + 1] 3, what would be the *point* of doing this?
What is the block suppose to *do* with the 3?  Do you want to extend this
to [:x :y | x + y] 3 4 ?  If not, why not?  What about [3+4] "what to put here?"
As for composition, my own library has
 ( [:x | x + 1] before: [:y | y * 2] ) value: 10   => 22
 ( [:y | y * 2] after: [:x | x + 1] ) value: 10 => 22
with no magic syntax needed.

The |> operator in F# has been imitated in several other languages.
I've implemented it in my Smalltalk, and tested it, but never bothered to use
it.

Object
  methods for: 'combinators'
|> unary
  ^(unary isMemberOf: NiladicSelector) "isKindOf: Symbol"
 ifTrue:  [unary send_to: self]"self perform: unary"
 ifFalse: [unary value: self]

MonadicBlock
  methods for: 'invoking'
collect
  ^[:collection | collection collect: self]

do
  ^[:collection | collection  do: self]

reject
  ^[:collection | collection  reject: self]

select
  ^[:collection | collection  select: self]

NiladicSelector
  methods for: 'invoking'
collect
  ^[:collection | collection collect: [:each | each perform: self]]

do
  ^[:collection | collection  do: [:each | each perform: self]]

reject
  ^[:collection | collection  reject: [:each | each perform: self]]

select
  ^[:collection | collection  select: [:each | each perform: self]]

10 |> [:x | x+1] |> [:y | y*2]  ==> 22
#(1 2 3) |> [:x | x * 10] collect => #(10 20 30)



Re: [Pharo-users] Import a pharo 6 image in pharo 7

2019-10-23 Thread Oswall Verny Arguedas C.
Thank you for your answers
I will try STON first.

After passing the data from pharo 6 image to pharo 7, I also want to move
it to Document Database.
This process is not vital at the moment, I can do it in steps.

For this reason, I asked about Mongo and CouchDB.

Oswall


El sáb., 19 de oct. de 2019 a la(s) 19:02, Sean P. DeNigris (
s...@clipperadams.com) escribió:

> Alejandro Infante wrote
> > I agree with the previous suggestions and use Fuel or STON.
>
> +1. Either of these methods is pretty much a one-liner. The main hiccup
> with
> Fuel is installing the same Fuel version in both the source and target
> images.
>
>
>
> -
> Cheers,
> Sean
> --
> Sent from: http://forum.world.st/Pharo-Smalltalk-Users-f1310670.html
>
>


Re: [Pharo-users] BlockClosure

2019-10-23 Thread Sven Van Caekenberghe
Hi Johan,

That is nice indeed. It is good to see that you have fun learning Pharo 
Smalltalk.

Can you do it ? Of course, you can do what you want, Pharo Smalltalk is a 
highly flexible environment.

Key to its simplicity are its ultra simple syntax which hits a magical optimum 
between simplicity and capability (full syntax on a postcard). With just 
messages and block, you can express almost anything (one limitation is that 
there are no macros). 

Part of that is (for me at least), left to right evaluation/reading - trying to 
change that 'hurts'. Binary operators are useful and even necessary, but the 
problem with totally new uses is that readers won't understand them. Being a 
bit more verbose helps, in my opinion.

You might also be interested in the following:

 Lambda Calculus in Pharo
 Yes, the Y Combinator is useful in normal programs
 https://medium.com/concerning-pharo/lambda-calculus-in-pharo-a4a571869594

Regards,

Sven

> On 23 Oct 2019, at 15:12, main  wrote:
> 
> Hi again!
> 
> Just putting it out there for anyone interested.
> 
> What I did was define the following in Object:
> 
> |> aBlock
>   ^ [ :x | x => self => aBlock ]
> 
> and also:
> 
> => msg
>   ^ msg value: self
> 
> 
> This enabled me to compose like this (I know I probably violate every rule
> in the book, whatever ):
> 
> f :=  [ :x | x + 100 ].
> g := [ :x | x +   20 ].
> h := [ :x | x + 3 ].
> 
> 0 => (f |> g |> h). 123
> 
> Also tried using ~:
> 
> 0 => (f ~ g ~ h). 123
> 
> It's just a matter of taste I guess, but for me it warms my heart 
> 
> 
> 
> --
> Sent from: http://forum.world.st/Pharo-Smalltalk-Users-f1310670.html
> 




Re: [Pharo-users] BlockClosure

2019-10-23 Thread Steffen Märcker

Looks nice!

Just my two cents. To make function comopostion work with multiple
aruments, I implemented * as:

  BlockClosure class>>* first
^ComposedFunction first: first second: self

And use a dedicated class to make multiple arguments work:

  ComposedFunction>>value: arg
^second value: (first value: arg)

  ComposedFunction>>value: arg1 value: arg2
^second value: (first value: arg1 value arg2)

Then, we can write:

  [:x | x factorial ] * [:x :y | x + y]
value: 1 value: 2


(I usually use the mathematical compostion operator, wich evalutes from
right to left.)

However, it is often convenient to interchange Symbols and Blocks, e.g.,
the above can be rewritten as

  #factorial * #+
value: 1 value: 2

That requires to implement the * operator on symbols, too. And depending
on your Smalltalk implemenation, you may have to implement the evaluation
protocol on symbols.

Best, Steffen


Am .10.2019, 15:12 Uhr, schrieb main :


Hi again!

Just putting it out there for anyone interested.

What I did was define the following in Object:

|> aBlock
^ [ :x | x => self => aBlock ]

and also:

=> msg
^ msg value: self


This enabled me to compose like this (I know I probably violate every
rule
in the book, whatever ):

f :=  [ :x | x + 100 ].
g := [ :x | x +   20 ].
h := [ :x | x + 3 ].

0 => (f |> g |> h). 123

Also tried using ~:

0 => (f ~ g ~ h). 123

It's just a matter of taste I guess, but for me it warms my heart



--
Sent from: http://forum.world.st/Pharo-Smalltalk-Users-f1310670.html




Re: [Pharo-users] BlockClosure

2019-10-23 Thread main
Hi again!

Just putting it out there for anyone interested.

What I did was define the following in Object:

|> aBlock
^ [ :x | x => self => aBlock ]

and also:

=> msg
^ msg value: self


This enabled me to compose like this (I know I probably violate every rule
in the book, whatever ):

f :=  [ :x | x + 100 ].
g := [ :x | x +   20 ].
h := [ :x | x + 3 ].

0 => (f |> g |> h). 123

Also tried using ~:

0 => (f ~ g ~ h). 123

It's just a matter of taste I guess, but for me it warms my heart 



--
Sent from: http://forum.world.st/Pharo-Smalltalk-Users-f1310670.html



[Pharo-users] Rocking Smalltalk

2019-10-23 Thread Richard Kenneth Eng
https://youtu.be/-uTzhRLcWC4

A rock video for the Smalltalk programming language.


Re: [Pharo-users] BlockClosure

2019-10-23 Thread Kasper Osterbye
On Wed, Oct 23, 2019 at 2:21 PM p...@highoctane.be 
wrote:

> It is like Object>>in: aBlock no?
>
Yes.

But because it is an operator, you can write "obj => block => block =>
block".
You can not write "obj in: block in: block in: block", because smalltalk
will think it is a selector named "in:in:in:".

Best,

Kasper


Re: [Pharo-users] BlockClosure

2019-10-23 Thread p...@highoctane.be
It is like Object>>in: aBlock no?



On Wed, 23 Oct 2019, 10:27 Kasper Osterbye, 
wrote:

> You can define a method "=>" in Object as:
>
> => aBlock
> ^ aBlock value: self
>
> That would allow you to write expressions like this:
> 7 => [ :x | x+3 ] => [ :x| x*3 ],
>
> if you further define "=>" in Array as:
>
> => aBlock
> ^ aBlock valueWithArguments: self
>
>
> you are able to write your example:
> (([ :f :g | [ :x | f (g x) ] ]) [:x | x + 1] [:x | x - 1]) 5
>
> as:
>
> 5 => ({ [:x | x + 1].  [:x | x - 1]} => [ :f :g | [ :x | x => g =>f ] ]).
>
> It reads from left to right where yours is the usual Arabic (right to
> left) favoured in functional style.
>
>
>


Re: [Pharo-users] BlockClosure

2019-10-23 Thread Kasper Osterbye
You can define a method "=>" in Object as:

=> aBlock
^ aBlock value: self

That would allow you to write expressions like this:
7 => [ :x | x+3 ] => [ :x| x*3 ],

if you further define "=>" in Array as:

=> aBlock
^ aBlock valueWithArguments: self


you are able to write your example:
(([ :f :g | [ :x | f (g x) ] ]) [:x | x + 1] [:x | x - 1]) 5

as:

5 => ({ [:x | x + 1].  [:x | x - 1]} => [ :f :g | [ :x | x => g =>f ] ]).

It reads from left to right where yours is the usual Arabic (right to left)
favoured in functional style.


Re: [Pharo-users] BlockClosure

2019-10-23 Thread pmissech

Hi,


The first part could be done, but with limitations.

- you won't be able to value it with anything but variables names

- those variables cannot have the same name as a method of BlockClosure

- I don't think this can be implemented by default in Pharo, as it is 
kinda "dangerous"


- might be unreliable, i don't know how stable Context is. ( For my own 
experiments, I have some problem with P7, but my stuff work fine on P8)



You'd have to implement something like:

BlockClosure >> DoesNotUnderstand: aMessage
    valueOfSelector := self outerContext at: aMessage selector 
ifAbsent:[ ^ super doesNotUnderstand "The variable isn't found in the 
context, so it's a real DNU "].


    self valueWithArguments: valueOfSelector asArray "allows us to have 
several arguments"



So if you did:

aVariable := 3.

[:x | x + 3] aVariable.


The block would say it didn't understand the message aVariable, and 
you'd perform it in the doesNotUnderstand hook you just override.


I guess it'd be something similar for the second part of your question, 
but i'm pretty sure it becomes unreadable rather quickly ˆˆ



PS: I didn't test this, but it's something in that spirit.

the context access might not be outerContext.

Pierre.


On 23/10/2019 09:22, main wrote:

Hello fellow Pharoians (?) from a lonely Swede.

I just found out about Pharo (and Smalltalk) two days ago and I'm already
loving it :)
However, there is a behavior I would like to change, or be enlightened about
how it could be done.

As I understand it (bear with me) BlockClosure from Kernel-Methods does not
understand (by default?) how to respond to an "anonymous object" (no message
name).

Is there any way this could be implemented? I'll post an example soon
(I currently use both Pharo 7 and 8)

If I write the following:

[:x | x + 1] value: 3

and evaluate it, I get the expected result, which is 4.

That's nice.

What I would really like is to be able to just send 3 to BlockClosure and
make it repond as above.

Like this:

[:x | x + 1] 3

or like this:

3 [:x | x + 1]

Would this be possible?

---

Also as a bonus, would it be possible to use this for "function
composition", "Block composition" or similar?

Example of composition:

[ :f :g | [ :x | f value: (g value: x) ] ]

I could use this construct like this for example:

(([ :f :g | [ :x | f value: (g value: x) ] ])
value: [:x | x + 1]
value: [:x | x - 1])
value: 5

But… It's a bit wordy.

What I would like to be able to do (essentialy remove "value:"):

(([ :f :g | [ :x | f (g x) ] ])
[:x | x + 1]
[:x | x - 1])
5.

Or in one line:
(([ :f :g | [ :x | f (g x) ] ]) [:x | x + 1] [:x | x - 1]) 5.

While this might seem obscure, I would really find it useful.

Can it be done?

Thanks in advance



--
Sent from: http://forum.world.st/Pharo-Smalltalk-Users-f1310670.html





Re: [Pharo-users] BlockClosure

2019-10-23 Thread Esteban Maringolo
There's no way you could use an integer (or any  number) as a selector.

So what you can do if you want to avoid using the "wordy" #value: selector
is to implement your own selector in BlockClosure.

It could be a #v: selector (so it is still a keyword selector) or a symbol
such as #<< that ends up calling #value:, but keep in mind that if you use
a symbol you cannot extend it to have more than one parameter.

Regards,



El mié., 23 de octubre de 2019 09:22, main 
escribió:

> Hello fellow Pharoians (?) from a lonely Swede.
>
> I just found out about Pharo (and Smalltalk) two days ago and I'm already
> loving it :)
> However, there is a behavior I would like to change, or be enlightened
> about
> how it could be done.
>
> As I understand it (bear with me) BlockClosure from Kernel-Methods does not
> understand (by default?) how to respond to an "anonymous object" (no
> message
> name).
>
> Is there any way this could be implemented? I'll post an example soon
> (I currently use both Pharo 7 and 8)
>
> If I write the following:
>
> [:x | x + 1] value: 3
>
> and evaluate it, I get the expected result, which is 4.
>
> That's nice.
>
> What I would really like is to be able to just send 3 to BlockClosure and
> make it repond as above.
>
> Like this:
>
> [:x | x + 1] 3
>
> or like this:
>
> 3 [:x | x + 1]
>
> Would this be possible?
>
> ---
>
> Also as a bonus, would it be possible to use this for "function
> composition", "Block composition" or similar?
>
> Example of composition:
>
> [ :f :g | [ :x | f value: (g value: x) ] ]
>
> I could use this construct like this for example:
>
> (([ :f :g | [ :x | f value: (g value: x) ] ])
> value: [:x | x + 1]
> value: [:x | x - 1])
> value: 5
>
> But… It's a bit wordy.
>
> What I would like to be able to do (essentialy remove "value:"):
>
> (([ :f :g | [ :x | f (g x) ] ])
> [:x | x + 1]
> [:x | x - 1])
> 5.
>
> Or in one line:
> (([ :f :g | [ :x | f (g x) ] ]) [:x | x + 1] [:x | x - 1]) 5.
>
> While this might seem obscure, I would really find it useful.
>
> Can it be done?
>
> Thanks in advance
>
>
>
> --
> Sent from: http://forum.world.st/Pharo-Smalltalk-Users-f1310670.html
>
>


[Pharo-users] BlockClosure

2019-10-23 Thread main
Hello fellow Pharoians (?) from a lonely Swede.

I just found out about Pharo (and Smalltalk) two days ago and I'm already
loving it :)
However, there is a behavior I would like to change, or be enlightened about
how it could be done.

As I understand it (bear with me) BlockClosure from Kernel-Methods does not
understand (by default?) how to respond to an "anonymous object" (no message
name).

Is there any way this could be implemented? I'll post an example soon
(I currently use both Pharo 7 and 8)

If I write the following:

[:x | x + 1] value: 3 

and evaluate it, I get the expected result, which is 4.

That's nice.

What I would really like is to be able to just send 3 to BlockClosure and
make it repond as above.

Like this:

[:x | x + 1] 3

or like this:

3 [:x | x + 1]

Would this be possible? 

---

Also as a bonus, would it be possible to use this for "function
composition", "Block composition" or similar?

Example of composition:

[ :f :g | [ :x | f value: (g value: x) ] ]

I could use this construct like this for example:

(([ :f :g | [ :x | f value: (g value: x) ] ]) 
value: [:x | x + 1]
value: [:x | x - 1])
value: 5

But… It's a bit wordy.

What I would like to be able to do (essentialy remove "value:"):

(([ :f :g | [ :x | f (g x) ] ]) 
[:x | x + 1] 
[:x | x - 1]) 
5.

Or in one line:
(([ :f :g | [ :x | f (g x) ] ]) [:x | x + 1] [:x | x - 1]) 5.

While this might seem obscure, I would really find it useful.

Can it be done?

Thanks in advance 



--
Sent from: http://forum.world.st/Pharo-Smalltalk-Users-f1310670.html



[Pharo-users] The Lands Platform at SLE 2019: Pharo magic inside

2019-10-23 Thread Nick Papoylias
The Lands Platform: Lan.guages and D.omain S.yntax,
@sleconf 2019, co-located with @splashcon

https://youtu.be/HMgJK8mVPYw

Showcasing live magic tricks powered by the @pharoproject

Best,

Nick