Dutch national flag problem: Difference between revisions

(Added Quackery.)
Line 3,379:
[ 3 ] is blue ( --> n )
 
[ true swap
behead do swap
witheach
[ do tuck > if
[ dip not
conclude ] ]
drop ] is sorted ( [ --> b )
 
[] ' [ red white blue ]
witheach
[ swap
4 random 1+ times [ ' blue nested join ]
[] 4 random 1+ times [ ' redover nested join ]
nip ]
 
[ shuffle dup sorted not until ]
 
[] 4 random 1+ times [ ' red nested join ]
4 random 1+ times [ ' white nested join ]
4 random 1+ times [ ' blue nested join ]
[ shuffle dup sorted not until ]
say "Before sorting: " dup echo cr
say " After sorting: " sortwith [ dip do do > ] echo cr</syntaxhighlight>
1,493

edits