Earlier quoted context omitted.
Quicksort in FP? Surely you mean mergesort, that's the classic FP sorting example.
quicksort, e.g. the haskell[0] example is quite well known. Problem is, it's not real since it doesn't work in place defeating the whole point. [0] https://qnikst.github.io/posts/2020-10-18-quicksort.html
Quicksort explained IKEA-style
71–80 of 142 posts
Re: Quicksort explained IKEA-style
#72Re: Quicksort explained IKEA-style
#73Quick sort with Hungarian, folk dance
Re: Quicksort explained IKEA-style
#74I am wondering if we could use any llm to generate similar graphs lol.
Re: Quicksort explained IKEA-style
#75If I didn't know how quicksort works - and I had to learn, since for some reason in FP languages quicksort is typically next after "hello world" - I would struggle to make sense of the pictures, I think. However, it's absolutely brilliant as a memory refresher: it packs so much info in so little space that it's insanely efficient. I imagine it would pair well with a good textbook on algorithms.
> for some reason in FP languages quicksort is typically next after "hello world" Because the recursive implementation is surprisingly straightforward and concise, and more-less demonstrates what the whole paradigm is about. As much as I hate to admit it, it's a good learning artifact.
Re: Quicksort explained IKEA-style
#76This is so cool! Not only is the design similar, but just like the real IKEA instructions, I can't understand them! This is as realistic as it gets.
Re: Quicksort explained IKEA-style
#77I guess what it's trying to say is just "mark it as needing to be to the right", and then do the opposite in (4) and then (5) is where things actually move.
Re: Quicksort explained IKEA-style
#78Re: Quicksort explained IKEA-style
#79Earlier quoted context omitted.
> since for some reason in FP languages quicksort is typically next after "hello world" How does FP handle the random selection?
There's no problem with randomness in FP? You could use a monad/external state for an OS-level RNG, or define a purely functional PRNG
(Merge sort is of course the natural sort for lists, but qs is like 2 lines of Haskell so it gets demoed for being clever)
Re: Quicksort explained IKEA-style
#80As for the actual Ikea-style instruction pamphlet... I suspect that making it was very helpful for the author. But I don't think the result would have helped me as a novice. It took some work for me to understand the diagram, and I've used Quicksort.