Thanks for all the reply. I solved the task using apply(as suggested by
Hans).
The tips on S-Poetry and ?Logic are very handy as well.

	[[alternative HTML version deleted]]

