[Newbies] closed and open interval
Michael van der Gulik
mikevdg at gmail.com
Mon Nov 24 20:56:30 UTC 2008
2008/11/25 Michael van der Gulik <mikevdg at gmail.com>
> On Tue, Nov 25, 2008 at 5:46 AM, Randal L. Schwartz <merlyn at stonehenge.com
> > wrote:
>> >>>>> "Filip" == Filip Malczak <filet00 at gmail.com> 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:
>> and the corresponding "right" methods, rather than an explicit boolean.
>> More flexibility later.
> Or how about
> a := 1 to: $B!g(B.
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 :-).
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Beginners