[squeak-dev] A little puzzle

Stéphane Rollandin lecteur at zogotounga.net
Thu May 14 16:38:58 UTC 2015


Thanks for your answers.

Unfortunately in my actual use case (of which the puzzle is just the 
simplest representation) I am not allowed to work on the collection side 
(and other iterating methods than #do: can be used by the iterator factory).


But actually, I think I just found a workaround: throw an exception, 
such as Abort which by the way seems to be unused.


blockIterating: aCollection

	^ [:doBlock :whileBlock |
		[aCollection do: [:i |
			(whileBlock value: i)
				ifFalse: [Abort signal].
			doBlock value: i]] on: Abort do: []]


Stef


More information about the Squeak-dev mailing list