Zig-zag matrix: Difference between revisions

(Added Quackery.)
Line 5,216:
{{trans|Python:_By_sorting_indices}}
 
<lang Quackery> [ dup]'[ tuck do dip do ] is with2 ( x x --> x tempx put)
 
[] swap
[ dup * times [ i^ jointemp ]put
sortwith [] swap
dup [* temptimes share[ /modi^ tuckjoin +]
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 + <> ]
[] swapsortwith
witheach [ with2
[ itemp joinshare nested/mod join+ ]
sortwith > ]
dup witheach
[ 0 peek swap 0 peek > ]
[] swapi^ unrot poke ]
witheach [] swap
temp [share 1 peek join ]times
[] swaptemp share split
dip [ nested join ] ]
temp share times
drop
[ temp share split
drop temp release ] is zigzag ( n --> [ )
dip [ nested join ] ]
drop temp release ] is zigzag ( n --> [ )
 
10 zigzag
1,488

edits