Disentangling iteration from value accumulation
Iteration forms and forms which accumulate values don’t have to be the same thing. I think that it turns out that separating them works rather well.
Iteration forms and forms which accumulate values don’t have to be the same thing. I think that it turns out that separating them works rather well.
Hosting code on GitHub now seems like an invitation to have it turned into AI slop. Here’s what I did to move.
This is adapted from an email from my friend Zyni, used with her permission. Don’t take it too seriously.
Or, why limitations matter.
Štar is a concise and extensible iteration construct for Common Lisp which aims to be pleasant to use, easy to understand, fast if needed, general, and not to look like Fortran.
Symbol nicknames allows multiple names to refer to the same symbol in supported implementations of Common Lisp. That may or may not be useful.
In a previous article my friend Zyni wrote some variations on a list-flattening function, some of which were ‘recursive’ and some of which ‘iterative’, managing the stack explicitly. We thought it would be interesting to see what the performance differences were, both for this function and a more useful variant which searches a tree rather than flattening it.
Very often people regard the stack as a scarce, expensive resource, while the heap is plentiful and very cheap. This is absurd: the stack is memory, the heap is also memory. Deforming programs so they are ‘iterative’ in order that they do not run out of the stack we imagine to be so costly is ridiculous: if you have a program which is inherently recursive, let it be recursive.
My friend Zyni wrote a comment to a thread on reddit with some variations on a list-flattening function. We’ve since spent some time thinking about things related to this, which is written up in a following article. Here is her comment so the following article can refer to it. Other than notes at the end the following text is Zyni’s, not mine.
Everyone who has written Lisp has written tiny Lisp evaluators in Lisp: here are two more.