You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
c :=OrderedCollectionnew.
(January first, 2015to:December first, 2015by:1 monthMeasure)
do: [ :each | c add: each ].
c size "335"
I get an OrderedCollection of 335 elements, many of them are in the future... I think this should be answering 12 elements (one for each month), but advancement fails.
If I do this:
c :=OrderedCollectionnew.
(January, 2015to:December, 2015by:1 monthMeasure)
do: [ :each | c add: each ].
c size "335"
It works, but just because happens than size was always 12 (because I declared an interval in months).
If I rewrite #do: as this:
element := from.
[ element < to ] whileTrue: [
aBlock value: element.
element := intervalStrategy advanceFrom: element by: by ].
Now it works, but other tests fails.
How to proceed from here? Is this a bug or I'm doing something wrong?
The text was updated successfully, but these errors were encountered:
Hi Esteban,
If you wan't to iterate over an interval of dates and wan't to collect one date in particular, I could imagine that reading your first example, you could do this: | c | c := OrderedCollection new. (January first, 2015 to: December first, 2015 everyDayNumber: 1) do: [ :each | c add: each ]. c size "12"
In this case, each element of c is the first date of each month of 2015.
But, be careful, if you do this: | c | c := OrderedCollection new. (January first, 2015 to: December first, 2015 everyDayNumber: 31) do: [ :each | c add: each ]. c size "6"
Here the size is 6 because there is only six months with 31 days in the year.
The model behave in strange way when iterating like you write the first example, maybe there's a bug. If you found a way to solve this without break other things, please do it and share your solution with all. Thanks.
Hi,
I get an OrderedCollection of 335 elements, many of them are in the future... I think this should be answering 12 elements (one for each month), but advancement fails.
If I do this:
It works, but just because happens than size was always 12 (because I declared an interval in months).
If I rewrite
#do:
as this:Now it works, but other tests fails.
How to proceed from here? Is this a bug or I'm doing something wrong?
The text was updated successfully, but these errors were encountered: