
13 Jul
2023
13 Jul
'23
10:44 a.m.
Perhaps, if the students have been in contact with a language that has explicit pointers (C or C++), let them implement linked lists and concatenation in that procedural language. (An AI will likely also produce a correct implementation nowadays.) The advantage is that one can inspect the values of the pointers to see whether any copying has happened. Then the students easily see that only the spine (structure holding pointers) is re-created, but the memory the list elements point to is never touched. That is an instance of parametricity, I believe. The fact that length (replicate 3 undefined ++ replicate 2 undefined) evaluates to 5 also shows this. Olaf