File tree Expand file tree Collapse file tree 2 files changed +18
-4
lines changed
Expand file tree Collapse file tree 2 files changed +18
-4
lines changed Original file line number Diff line number Diff line change @@ -188,6 +188,17 @@ DataSeriesTest >> testArithmeticsDivideSeriesBySeriesSameKeysDifferentName [
188188 self assert: actual equals: expected
189189]
190190
191+ { #category : #' as yet unclassified' }
192+ DataSeriesTest >> testArithmeticsDivideSeriesBySeriesWithNils [
193+
194+ | a b c |
195+ a := #( 2 4 nil ) asDataSeries.
196+ b := #( 1 nil 3 ) asDataSeries.
197+ c := #( 2 nil nil ) asDataSeries.
198+
199+ self assert: a / b equals: c
200+ ]
201+
191202{ #category : #arithmetic }
192203DataSeriesTest >> testArithmeticsMultiplyArrayBySeries [
193204
Original file line number Diff line number Diff line change @@ -92,10 +92,13 @@ DataSeries >> adaptToCollection: rcvr andSend: selector [
9292 " If I am involved in arithmetic with another Collection, return a Collection of
9393 the results of each element combined with the scalar in that expression."
9494
95- (rcvr isSequenceable and : [ self isSequenceable ]) ifFalse:
96- [self error: ' Only sequenceable collections may be combined arithmetically' ].
97- ^ rcvr withSeries: self collect:
98- [:rcvrElement :myElement | rcvrElement perform: selector with: myElement]
95+ (rcvr isSequenceable and : [ self isSequenceable ]) ifFalse: [ self error: ' Only sequenceable collections may be combined arithmetically' ].
96+
97+
98+ ^ rcvr withSeries: self collect: [ :rcvrElement :myElement |
99+ (rcvrElement isNil or : [ myElement isNil ])
100+ ifTrue: [ nil ]
101+ ifFalse: [ rcvrElement perform: selector with: myElement ] ]
99102]
100103
101104{ #category : #converting }
You can’t perform that action at this time.
0 commit comments