Dutch national flag problem: Difference between revisions
Content added Content deleted
(Added Uiua solution) |
(Added Quackery.) |
||
Line 3,372: | Line 3,372: | ||
main()</syntaxhighlight> |
main()</syntaxhighlight> |
||
Output follows that of the sorting solution above. |
Output follows that of the sorting solution above. |
||
=={{header|Quackery}}== |
|||
<syntaxhighlight lang="Quackery"> [ 1 ] is red ( --> n ) |
|||
[ 2 ] is white ( --> n ) |
|||
[ 3 ] is blue ( --> n ) |
|||
[ true swap |
|||
behead do swap |
|||
witheach |
|||
[ do tuck > if |
|||
[ dip not |
|||
conclude ] ] |
|||
drop ] is sorted ( [ --> b ) |
|||
[] 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> |
|||
{{out}} |
|||
<pre>Before sorting: [ white blue blue red red blue white red blue white red ] |
|||
After sorting: [ red red red red white white white blue blue blue blue ] |
|||
</pre> |
|||
=={{header|Racket}}== |
=={{header|Racket}}== |