[Pharo-dev] About Fraction and parentheses

stepharong stepharong at free.fr
Tue Dec 20 16:18:36 EST 2016


On Tue, 20 Dec 2016 09:24:57 +0100, Sven Van Caekenberghe <sven at stfx.eu>  
wrote:

> Ah, OK, sorry about the misunderstanding.

you are welcome :)
Now I do not get why there would be ((1/3))
I have to check

>
>> On 20 Dec 2016, at 09:21, Stephane Ducasse <stepharo.self at gmail.com>  
>> wrote:
>>
>> I think that I know that :)
>> And this is why I mentioned that if you print 1/3 it prints (1/3) so  
>> that we can continue typing + (2/3)
>>
>> On Mon, Dec 19, 2016 at 11:02 PM, Sven Van Caekenberghe <sven at stfx.eu>  
>> wrote:
>>
>> > On 19 Dec 2016, at 22:00, Stephane Ducasse <stepharo.self at gmail.com>  
>> wrote:
>> >
>> > Hi serge
>> >
>> > the printing should be normal because like that you are ready to type
>> > 1/3 + 2/3 and get 1.
>>
>> No, not at all:
>>
>> 1/3 + 2/3
>>
>>   "(7/9)"
>>
>> These are all just binary messages evaluated left to right, like this:
>>
>> ((1/3) + 2)/3
>>
>>   "(7/9)"
>>
>> That is why you need the parenthesis in certain contexts.
>> Now adding two of them is definitively wrong.
>>
>> (1/3) + (2/3)
>>
>>   "1"
>>
>> (The first parenthesis are not needed, btw).
>>
>> > Now I do not get why you get ((1/2)) thanks for reporting it.
>> >
>> > Stef
>> >
>> > On Mon, Dec 19, 2016 at 9:08 AM, Serge Stinckwich  
>> <serge.stinckwich at gmail.com> wrote:
>> > I have one question about Fraction.
>> >
>> > When I print a fraction like 1/2 in the Playground I obtain (1/2) and
>> > when I inspect I obtain ((1/2)). Why do we need all these parentheses
>> > ?
>> >
>> > I didn't try with a current Pharo 6.0 image, because my bandwidth is
>> > quite limited right now (Vietnam).
>> >
>> > --
>> > Serge Stinckwich
>> > UCBN & UMI UMMISCO 209 (IRD/UPMC)
>> > Every DSL ends up being Smalltalk
>> > http://www.doesnotunderstand.org/
>> >
>> >
>>
>>
>>
>
>


-- 
Using Opera's mail client: http://www.opera.com/mail/




More information about the Pharo-dev mailing list