Sorting algorithms/Sleep sort: Difference between revisions

Content added Content deleted
(→‎{{header|Rust}}: updated for Rust 1.0 final)
(Bloated SNUSP!)
Line 1,243: Line 1,243:
6
6
11</pre>
11</pre>

=={{header|SNUSP}}==
Bloated SNUSP is ideally suited to this task, since this the variant adds multithreading and an additional dimension of data space. Sleep time is simulated by the loop delay required to copy each cell value, thereby ensuring that smaller values are printed earlier than larger values. This program requires a Bloated SNUSP interpreter which returns zero on input end-of-file.
<lang SNUSP>
/$>\ input until eof
#/?<\?,/ foreach: fork
\ &/:+ copy and\
/:\?-; delay /
\.# print and exit thread
</lang>

Legend:
* '''&''' - SPLIT creates a new thread. Like '''@''' ENTER, it skips one cell of code space to start its continuation.
* ''': ;''' - UP and DOWN are equivalent to '''< >''' LEFT and RIGHT, but moves the data pointer in the second dimension.
* '''#''' - in Bloated SNUSP, LEAVE only terminates the current thread. The overall program only exits when all threads have quit.


=={{header|Tcl}}==
=={{header|Tcl}}==