[Newbies] closed and open interval

Michael van der Gulik mikevdg at gmail.com
Mon Nov 24 20:53:36 UTC 2008


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:
>
> beOpenLeft
> beClosedLeft
> isOpenLeft
> isClosedLeft
>
> and the corresponding "right" methods, rather than an explicit boolean.
> More flexibility later.
>


Or how about

a := 1 to: ∞.

If you add the Unicode symbol for infinity as a global variable, it seems to
work okay. You just need to choose a font which has that symbol.
Alternatively, you could be boring and use a name like "Infinity".

Now, the implementation would be most interesting :-). You could go a bit
further and make infinity a valid number to use in code.

Gulik.



-- 
http://people.squeakfoundation.org/person/mikevdg
http://gulik.pbwiki.com/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.squeakfoundation.org/pipermail/beginners/attachments/20081125/820f4bf4/attachment.htm


More information about the Beginners mailing list