" Smalltalk/Point.st -*- Smalltalk -*- " Point : Magnitude ( x y ) Point x [ ^x ] Point y [ ^y ] Point x: xValue y: yValue [ self := self new. x := xValue. y := yValue. ] Point + aPoint [ ^Point x: x + aPoint x y: y + aPoint y ] Point - aPoint [ ^Point x: x - aPoint x y: y - aPoint y ] Point printOn: aStream [ aStream nextPut: $(; print: x; nextPutAll: ' @ '; print: y; nextPut: $) ] " ---------------------------------------------------------------- " Number @ aNumber [ ^Point x: self y: aNumber ]