Sorting algorithms/Shell sort/Whitespace

Revision as of 08:17, 9 March 2013 by rosettacode>Isopsephile (Add Whitespace implementation)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

This solution was tested and found to work correctly with the canonical Haskell interpreter, this Ruby version, and Pavel Shub's glorious C++ implementation. Most others either failed to run even the simplest of programs, were Windows-only, or else required tiresome setup.

It was observed early on that hard-coding the values to be sorted might rouse suspicion as to whether such an inscrutable program were really doing any sorting; thus it was decided that input would be provided at runtime. This led to the unfortunate discovery that not all of the aforementioned interpreters handle EOF in the same way; Haskell and Ruby error out where C++ returns a convenient -1. In the interest of compatibility, the program reads values until a literal -1 is provided; all other negative numbers are permissible and will be sorted appropriately, of course.

A demonstration of the program capable of receiving further test input is available on Ideone. This solution would very likely never have been written if it weren't for Vim and Solarized, the combination of which made its development an almost transcendental experience.

<lang Whitespace>









































</lang>