Very well spotted! Thank you very much! Added here: https://github.com/Apress/agile-ai-in-pharo/issues/6 I will fix in the second edition. Even if all the code contained in the book is automatically tested, in this case, this was not enough. Thank you! Alexandre -- _,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;: Alexandre Bergel http://www.bergel.eu ^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;.
On 21-08-2020, at 02:07, bentai <bentaisan@gmail.com> wrote:
I think I found another bug in the book. I am using the Safari version, and the code in the text doesn't match the screenshot. For example, the text says: somePoints := OrderedCollection new. 500 timesRepeat: [ somePoints add: {(50 atRandom - 25) . (50 atRandom - 25)}]. f := [ :x | (-2 * x) - 3 ]. "We use the Roassal Grapher engine to plot our points" g := RTGrapher new. d := RTData new. d dotShape color: [ :p | (p second > (f value: p first)) ifTrue: [ Color red trans ] ifFalse: [ Color blue trans ] ]. d points: somePoints. d x: #first. d y: #second. g add: d. g "" The rendered code in the Safari version gets an error, whereas the screenshot version works: f := [ :x | (-2 * x) - 3 ].
somePoints := OrderedCollection new. 500 timesRepeat: [ somePoints add: (( 50 atRandom - 25 ) @ ( 50 atRandom - 25 )) ].
g := RTGrapher new. d := RTData new. d dotShape color: [ :p | (p y > (f value: p x)) ifTrue: [ Color red trans ] ifFalse: [ Color blue trans ] ]. d points: somePoints. d x: #x. d y: #y. g add: d. g -----------------------------------------------------------------------------------
This may be part of the cause of my bug report on Git, e.g. there is a mismatch between the eBook version, the printed version and the Safari/OReilly version.
It is Pharo 7.0.4, but I don't know if that matters in this case.
I apologize for not following the procedure of cloning the github repository and creating bug request from there with pull requests, but I am still working out the configuration of Iceberg.
Cheers, Tom Sturgeon
Sent from the Pharo Smalltalk Users mailing list archive <http://forum.world.st/Pharo-Smalltalk-Users-f1310670.html> at Nabble.com.