[Newbies] closed and open interval

Cédrick Béler cdrick65 at gmail.com
Mon Nov 24 17:40:48 UTC 2008


Thanks all for these answers... I should have precised I knew about
Interval ;)  But you answered all and more. I wanted to be sure they
were no existing implementation of it.

I was also imaginating an implementation of a special kind of interval
(closed + open ends). I have some questions:

- does Interval is a good starting point
to me it looks like a closed interval but is not because there's a
step between the values which is one by default, so :

(0.0 to: 1.0) includes: 0.5  "false"

I'd like (0 to: 1) beRightOpen includes: 0.4356456  -> true...
(0 to: 1) beRightOpen includes: 1   "false"


and I'd also like (this is the original motivation):

(0 to: 1) by 0.25   equivalent to:   # (    [0  0,25[  [0  0,5[   [0
0,75[     [0  1]    )


Would you use Interval or create another class (distinct, super, sub...) ?

Thanks for all,

Cédrick

ps:

as an extra question, I wonder what has to be done (if possible) to
change the scanner so that:
[1 2]  creates an interval... it shouldn't be recognized as a block
because there's only number inside... maybe it would be difficult to
read though


More information about the Beginners mailing list