The linked list works well and is basically wrapping two variables in a closure in an object, the variables are "head" and "rest" (think LISP´s car and cdr).
I have also added some useful functions like map, fold, forEach, merge, reverse and sort among others.
All work well except for sort. as it only works with the default compare-function. I know that the reason is of how i append the list back together after a comparison.
Anyone has a better ideaAll work well except for sort. As it only works with the default compare-function. I know that the reason is of how this might be done? merge-sort?i append the list back together after a comparison.
Anyone has a better idea of how this might be done? merge-sort? Also suggestions on other parts of the project are welcome! :-)