[squeak-dev] RSChartExample almost all working.

gettimothy gettimothy at zoho.com
Sat Oct 24 12:30:32 UTC 2020


Hi Folks,



I am going through the RSChartExample examples.



Most are working.



The one below prefaced with an 'x' are not working , those without the 'x' are working...





RSChartExample new example01Markers open.

RSChartExample new example02ScatterPlot open.

RSChartExample new example03Plot open.

RSChartExample new example04WithTick open.

RSChartExample new example05WithTick open.

RSChartExample new example06CustomNumberOfTicks open.

RSChartExample new example07AdjustingFontSize open.

RSChartExample new example08TwoCharts open.

RSChartExample new example09LinearSqrtSymlog open.

RSChartExample new example10BarPlot open.

RSChartExample new example11BarplotCombinedWithLine open.

RSChartExample new example12ScatterPlotAndNormalizer open.

xRSChartExample new example13AreaPlot open.

xRSChartExample new example14AreaPlotWithError open.

xRSChartExample new example15AreaBox open.

xRSChartExample new example16Series open.

xRSChartExample new example17CLPvsUSD open.

xRSChartExample new example18Animation open.







The ones with the 'x' are failing on a method I have imported from pharo



Collection, Dictionary, SequenceableCollection, SortedCollection need to implement flatCollect:

Collection >>flatCollect: aBlock 

"Evaluate aBlock for each of the receiver's elements and answer the

list of all resulting values flatten one level. Assumes that aBlock returns some kind

of collection for each element. Equivalent to the lisp's mapcan"



"( #((3 4) (1 2)) flatCollect: [:each | each ] )>>> #(3 4 1 2)"

"( #(3 4 1 2) flatCollect: [:each | { each } ] ) >>> #(3 4 1 2)"



^ self flatCollect: aBlock as: self species



etc...



The error I am getting is an 'Attempt to index a non-existent element in an OrderedCollection from the flatCollect in SequenceableCollection...(The breaks and method vars are mine as I attempt to grok this)



SequenceableCollection >> flatCollect: aBlock

"Evaluate aBlock for each of the receiver's elements and answer the

list of all resulting values flatten one level. Assumes that aBlock returns some kind

of collection for each element. optimized version for Sequencable Collection and subclasses

implementing #writeStream"



"(#( (2 -3) (4 -5) #(-6)) flatCollect: [ :e | e abs  ]) >>> #(2 3 4 5 6)"



"(#( (2 -3) #((4 -5)) #(-6)) flatCollect: [ :e | e abs  ]) >>> #(2 3 #(4 5) 6)"

|x i|

self isEmpty

ifTrue: [ ^ self copy ].

i := 0.

x := self species

new: 0

streamContents: [ :stream | self do: [ :each |

i := i +1.

stream nextPutAll: (aBlock value: each).  <--BARFS HERE

self break.  <--NEVER REACHED

]].



^x.







The above fails in



SequenceableCollection >> replaceFrom: start to: stop with: replacement startingAt: repStart 

"This destructively replaces elements from start to stop in the receiver

starting at index, repStart, in the sequenceable collection,

replacementCollection. Answer the receiver. No range checks are

performed."



| index repOff |

repOff := repStart - start.

index := start - 1.

[(index := index + 1) <= stop]

whileTrue: [self at: index put: (replacement at: repOff + index)]   <- BARF HERE





at the at: put:



I will be figuring this out next.





FWIW, using the Git Browser on the pharo repo...I make the pharo9 "current' and then am able to get GradientPaint and required classes into Squeak....



steps are these:  





>From Git Browser....



Switch to Pharo9 branch.



src/Athens-Core browse Edition in Selected Version

in the browser...Athens-Core-Paints->AthensAbstractPaint

load class.

same for, GradientPaint  LinearGradientPaint and RadialGradientPaint



anyhoo, progress.





Also, the Morphic folks, once we get this working, will probably want to poke around to make the BalloonMorphs behave.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20201024/856d663a/attachment-0001.html>


More information about the Squeak-dev mailing list