Randal L. Schwartz a écrit :
"Filip" == Filip Malczak <[EMAIL PROTECTED]> writes:

Filip> You can always make subclass of Interval for example OpenedInterval , add
Filip> two variables: left and right.Make new methods:
OpenedInterval> from: aNumber to: aNumber left: aBoolean
OpenedInterval> from: aNumber to: aNumber right: aBoolean
OpenedInterval> from: aNumber to: aNumber left: aBoolean right: aBoolean

You're exposing implementation there.  I suggest:

beOpenLeft
beClosedLeft
isOpenLeft
isClosedLeft

and the corresponding "right" methods, rather than an explicit boolean.
More flexibility later.



> Gulik:
> Actually, this works fine in the image already:
>
> (1 to: Float infinity) includes: 1000   ---> true.
>
> I didn't really expect it to work. Smalltalk is good like that :-).
>
> Gulik.


Very nice that it works indeed. It was less obvious for this one:
    (1 to: Float infinity) includes: (10 raisedTo: 400).

Luckily, it does also work because of tricky IEEE policy:
    (Float infinity = Float infinity).
Above equality is far from obvious knowing:
    (Float infinity - Float infinity) isNan...
Don't know what they had in mind when comparing Infinities...

Anyway the Interval you proposed only has the cardinal of N.
Very small compared to the Cardinal of R required for [ 0 , 1 ].

Nicolas

_______________________________________________
Beginners mailing list
Beginners@lists.squeakfoundation.org
http://lists.squeakfoundation.org/mailman/listinfo/beginners

Reply via email to