On Wed, 25 Feb 2009, Frank Barknecht wrote:
Nothing really, but I still want to understand it. I added some comments in the attached version that describe how far I got with understanding. Am I completely off?
Maybe. There is nothing that the code does on specifically the first two elements of the list.
The [list split 2] just checks whether the list has more than one element, and if it has only one element, output it. There were several ways to do it, but they were about as complicated as each other. the [bang]s with the [spigot] are for making a conditional about lists longer than 1 element. after that, the splitting occurs recursively in equal halves just as in a merge-sort or binary-search on an array.
Apart from that, I'd expect comments on an implementation to be at a higher level than the implementation. People can follow the wires and figure out what happens between two consecutive objects, but they most need to know what's the overall pattern of it and why things were done the way they were, because they couldn't learn that from anywhere else.
My big mail to Enrique contains a lot of useful information about the patch.
Other useful hints I could give are that the way the list is split, is like a balanced binary tree. It didn't have to be balanced, though, but that's sort of an ideal default, and it's really absolutely only to avoid stack overflow, though in other situations it does save a _lot_ of processing (merge-sort, binary-search...).
_ _ __ ___ _____ ________ _____________ _____________________ ... | Mathieu Bouchard - tél:+1.514.383.3801, Montréal, Québec