Fractions

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

Fractions

J Pfersich
This doesn't make sense:
st> 123/3 asFraction !
41
but if I do this, it works out OK:
st> ((123/3) asFraction) printNl !
41/1
Fraction new "<0x103e0d0>"
and this:
st> 123/3  identityHash !
41
st> (123/3)  identityHash !
41
but if I do this, I get what I'm looking for (I think):
st> ((123/3) asFraction) identityHash !
27294
But isn't this just giving me the object index? (that can be reused?)



_______________________________________________
help-smalltalk mailing list
[hidden email]
http://lists.gnu.org/mailman/listinfo/help-smalltalk
Reply | Threaded
Open this post in threaded view
|

Re: Fractions

S11001001
J Pfersich wrote:
> This doesn't make sense:
> st> 123/3 asFraction !
> 41

asFraction is a unary message and / is a binary message.

Evaluation order:

1. unary messages
2. binary messages
3. keyword messages

--
Stephen Compall
http://scompall.nocandysw.com/blog


_______________________________________________
help-smalltalk mailing list
[hidden email]
http://lists.gnu.org/mailman/listinfo/help-smalltalk