The gridline mental model of indexing and slicing
Republished from my Github gist.
Integer indexes can either represent fenceposts (gridlines) or item pointers, and there's a sort of duality.
🔗
Mental model: Gridline-based "asymmetric indexing"
Memory or data is treated as a "pool of memory". Pointers and indices do not refer to…