
Bernie Pope wrote:
On 10/12/2006, at 10:50 PM, Andrew Savige wrote:
A popular C# approach goes something like:
private static string reverseWords(string str) { string[] words = Array.FindAll<string>(str.Split( new char[] {' ','\t'}), delegate(string s) { return !String.IsNullOrEmpty(s); }); int i = words.Length - 1; if (i < 0) return String.Empty; StringBuilder sb = new StringBuilder(words[i]); while (--i >= 0) sb.Append(' ').Append(words[i]); return sb.ToString(); }
Yikes! There ought to be a law against public displays of C# which are not accompanied by health warnings.
*** HNC Haskell News Channel - Headlines *** *** C# can cause code cancer *** Recent investigations by medical experts have shown that certain imperative programming language like C#,C++ and Java have a high risk of developing code cancer. "It has long been suspected that certain language species are more vulnerable to malign code proliferation than others. Yet the full danger has only been discovered as of now and astonishes even myself", says Dr. Haskell, leading expert for code sanity at the Higher Order Health Organisation (HOHO). "Code cancer diagnostics are still evolving these days, see my own research at http://www-users.cs.york.ac.uk/~ndm/projects/drhaskell.php. But when code for trivial problems grows ridiculously large, the diagnosis 'code cancer' is definite." Asked about recovery, Dr. Haskell explains "We currently do not posses a treatment for code cancer. Usually, the only solution is to erase the hard drive and to install a recent distribution of any modern Haskell compiler". Critics claim that the danger of code cancer is well known. Dr. Hylo, free scientist at the Haskell Institute for Healthy Induction (HIHI) http://wiki.di.uminho.pt/wiki/bin/view/Alcino/DrHylo points out that "while one cannot overestimate the well known role of a healthy and strong type system against code cancer as well as bug and virus infestations, this role is well known. On the other hand, the danger of exhaustion by general recursion is far underestimated and the remedy of unfolding the benefits of structural recursion is still under-appreciated. I further recommend to bracket it with eating five bananas a day." Regards, apfelmus, minion of the Haskell Association for Humorous Articles (HAHA)