? <include generator>;

<makedata #r #n>
	<for #r (#i #n)
		<nop (#x #y)>
		<letf #rad =<letf _ 2* ::sys <PI _>/#n*#i>>
		<letf #x = ::sys <cos _ #rad>>
		<letf #y = ::sys <sin _ #rad>>
	>
	;

<len 0.0 ((_ _))>;

<len #l ((#x1 #y1) (#x2 #y2) : #r)>
	<letf #ll = (#x2 - #x1)*(#x2 - #x1) + (#y2 - #y1)*(#y2 - #y1)>
	<letf #l2 = ::sys <sqrt _ #ll>>
	<len #l3 ((#x2 #y2) : #r)>
	<letf #l = #l2+#l3>
	;
		

<TraveringSalesman #r>
	<setVar maxlen 1000000>
	::generator <permutationAll (#i #r)
		<maxlen #max>
		<len #l #i>
		[
		 <comparef #l < #max>
			<print>
			<printf "Length : " <%_"g" #l> <\_n>>
			<print "   " #i>
			<setVar maxlen #l>
		]
	>
	;

? <makedata #r1 7> ::generator <permutation #r #r1> <TraveringSalesman #r>;



