A simple puzzle

ducasse ducasse at iam.unibe.ch
Tue Sep 9 09:03:57 UTC 2003


Hi

I have the following code:

verticalSymmetry: anArray from: anInteger
	"Return the collection of point symmetrical by reference to the
	abscissa anInteger"
	
	^ anArray
		collect: [:each | 2 * anInteger - each x @ each y]

that given a collection of point returns their symetrical based on a 
given abscissa
For example I have:

t := Turtle new.
points := t verticalSymmetry: {337 at 314 .  327 at 274 . 320 at 237 . } from: 
400.
	#(463 at 314 473 at 274 480 at 237)

Now this is really ugly because not really oo I would like to be able 
to write it only using collection manipulation:

I tried some collection manipulations such as the following one:

	col := {337 at 314 .  327 at 274 . 320 at 237}.
	(2 * 400 at 0) - col
	-> this fails :(

Does anybody has an idea to know whether it is possible?

Stef





More information about the Squeak-dev mailing list