Sorting a list would make a pretty fun code-golf challenge, but all the builtins make it boring! Its no fun when you spend all of your time golfing a function and then you see that someone else has a shorter answer just using a builtin!
The best way to solve this problem is to ban builtins, but no challenge has gone quite far enough! Most challenges only ban one or two builtins. We are going to ban them all!
Ok lets stop being sardonic for a moment.
Your task will be to write a function that takes a list of integers and returns a sorted version of the same list. You are to do this without the use of builtins
What are builtins?
To keep ourselves from having to navigate edge case hell we are going to limit answers to Haskell (sorry if Haskell is not your favorite language). We are going to define a builtin as any named function that is not defined in your code. We are going to say that symbolic operators, (+)
, (:)
, etc. are not builtin functions. This applies both to prelude and any libraries that are imported.
What does it mean to use?
Before anyone tries to get smart with me, using a function is using a function. Whether or not the function is named in your source code is irrelevant (this is not restricted-source), if you make calls to the function without naming it that is also considered cheating. That being said calls to a function are not the only form of use, you shouldn't name a builtin function in your code even if you don't call it (I don't know why you would want to do that but I'm not taking any risks).
Scoring
This is code-golf so you should aim to do this in as few bytes as possible. However since different algorithms are not going to be competitive, (merge sort answers are probably going to be longer than insertion sort answers) I would like this to be considered a competition among individual algorithms, just as normal code golf is a competition among individual languages. For that reason I would like you to name your algorithm used in your header instead of the language. If you don't know the name feel free to put Unknown.
Ord
types?Positive integers? Arbitrary types and we get an ordering function? \$\endgroup\$ – Laikoni Jul 8 '17 at 15:24