3 ms·
Why would they simulate a linked list using tuples? It seems a bit contrived (or rather, not Pythonic) when lists are a built-in datatype.
by MathProgramming 14y ago
Why would they simulate a linked list using tuples? It seems a bit contrived (or rather, not Pythonic) when lists are a built-in datatype.
- TeMPOraL 14y agoA quick way to emulate cons cells[1], which are good for explaining how linked lists work? [1] - http://en.wikipedia.org/wiki/Cons http://en.wikipedia.org/wiki/Cons
- pgbovine 14y agoYep, right on! I wanted to show off linked list recursion and render box-and-pointer diagrams like those seen in SICP.