Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Compress Ring.Link implementation slightly
The temporary variable names were for my 1:30am brain, but they don't actually add any clarity by virtue of only being 1 character long. However, giving them long names probably won't help either as there's just a lot of mental parsing overhead that's required when visualizing linked list operations anyway. So let's just nuke them and do it all in-line as a pair of multi-valued assignments, with slightly better comments. The first assignment is equivalent to 'b.next' and 'y.next' in the old code and covers linking self's tail node to other's head node, and other's tail node to self's head node. The second assignment is for 'a.prev' and 'x.prev' in the old code; this links our head node backwards to other's tail node, and other's head node back to our tail node. The second requires the use of a multi-value assignment, as it's effectively an exchange of values. In a multi-value assignment statement all expressions on the right of the '=' are evaluated first with their results stored on the stack, and then afterwards the actual assignments to the things on the left takes place.
- Loading branch information