Zig-zag matrix: Difference between revisions

Content added Content deleted
(Added Quackery.)
Line 5,216: Line 5,216:
{{trans|Python:_By_sorting_indices}}
{{trans|Python:_By_sorting_indices}}


<lang Quackery> [ dup temp put
<lang Quackery> [ ]'[ tuck do dip do ] is with2 ( x x --> x x )

[] swap
dup * times [ i^ join ]
[ dup temp put
sortwith
[] swap
[ temp share /mod tuck +
dup * times [ i^ join ]
sortwith
1 & if negate swap
temp share /mod tuck +
[ with2
1 & if negate < ]
[ temp share /mod
tuck + 1 &
sortwith
[ temp share /mod + swap
if negate ]
temp share /mod + < ]
> ]
[] swap
sortwith
witheach
[ with2
[ i join nested join ]
[ temp share /mod + ]
sortwith
> ]
dup witheach
[ 0 peek swap 0 peek > ]
[] swap
[ i^ unrot poke ]
witheach
[] swap
[ 1 peek join ]
temp share times
[] swap
[ temp share split
dip [ nested join ] ]
temp share times
drop
[ temp share split
temp release ] is zigzag ( n --> [ )
dip [ nested join ] ]
drop temp release ] is zigzag ( n --> [ )


10 zigzag
10 zigzag