in reply to Re^4: short sorts
in thread short sorts
I've been trying to learn Haskell for greater good. It's a functional language, which (among other things) means functions are first class citizens: you can pass them as arguments to other functions, return them from functions, and easily combine them with other functions.
e.g. whereas in Perl you can create a new string with
in Haskell you can create a new function with
$foo = $bar . $ram . $ewe;
(assuming all the argument types match up).
f = g . h . i
That's what the Compose function I wrote does. I thought of doing that after noticing how similar your various sort functions were, and how they could be built by composing/layering basic operations on top of one another.
I'm not suggesting you write your code like that, I wrote it mainly out of curiosity to see what such a functional style would look like in Perl.