On 24.11.2008, at 15:03, Cédrick Béler wrote:
Hi
Is there an existing data structure that allow to represent interval
with either open or closed ends like [1 ; 10[.
Class Interval is closed:
1 to: 10
I don't think there is an open interval class.
- Bert -
Hello
Squeak has Interval that represents interval with closed ends.
See the samples below:
(Interval from: 1 to: 10) includes: 2 -- true
(Interval from: 1 to: 10) includes: 10 -- true
(Interval from: 1 to: 10) includes: 11 -- false
2008/11/24 Cédrick Béler [EMAIL PROTECTED]
Hi
Is there an
You can always make subclass of Interval for example OpenedInterval , add
two variables: left and right.Make new methods:
OpenedIntervalfrom: aNumber to: aNumber left: aBoolean
OpenedIntervalfrom: aNumber to: aNumber right: aBoolean
OpenedIntervalfrom: aNumber to: aNumber left: aBoolean right:
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
Bert == Bert Freudenberg [EMAIL PROTECTED] writes:
Bert On 24.11.2008, at 17:46, Randal L. Schwartz wrote:
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:
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:
-
On 24.11.2008, at 18:36, Randal L. Schwartz wrote:
Bert == Bert Freudenberg [EMAIL PROTECTED] writes:
Bert On 24.11.2008, at 17:46, Randal L. Schwartz wrote:
Filip == Filip Malczak [EMAIL PROTECTED] writes:
Filip You can always make subclass of Interval for example
OpenedInterval
,
(0 to: 1) by: 0.25 equivalent to: # ([0 0,25[ [0 0,5[ [0
0,75[ [0 1])
Of course, I meant:
(0 to: 1) by 0.25 -- #( [0 0,25[ [0,25 0,5[ [0,5 0,75[
[0,75 1]) an array of interval, ie. a discretized
interval
(0 to: 1) leftOpen by: 0.25 -- #( ]0 0,25[
On 24.11.2008, at 17:46, Randal L. Schwartz wrote:
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
Hmm... When you were talking I wasnt aware of discussion and made up some
basis for this subclass. I send it with this mail.
Now Im gonna work on Intervals arithmetics to each other, for example:
OpenedInterval from: 1 to: 5 right: true sumWith Interval from: 5 to: 8
should give
Interval (or
2008/11/24 Cédrick Béler [EMAIL PROTECTED]
Interval - I represent a finite arithmetic progression.
What about infinite arithmetic progression ? ;)
Can a collection contain an infinite number of elements... ?
[0 1[ could represent the collection of **all number** between 0 and 1
excluded.
What do you need it for? As you can see in methods for Interval - there are
two tests for include : rangeIncludes and valueIncludes (includes is both of
them connected).
First checks if a number is beetween borders and second if its enumerated
(with stepping). In deed it contains both:
On Tue, Nov 25, 2008 at 5:46 AM, Randal L. Schwartz
[EMAIL PROTECTED]wrote:
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
13 matches
Mail list logo