Friday, July 10, 2015

to sleep, perchance to sort

for arg in args run printNumber(arg) in backgroundendwait for all processes to finish

So if you have a list of n integers, it will launch n threads, and each individual thread will finish after whatever the number of seconds it is. When all the threads are done, you will have finished printing your sorted list!

This is obviously a terrible idea, but I kind of love how it moves the usual "work" of sorting to a side-effect byproduct.