UPDATE: I do now see the code, and how it works. (What follows still reflects my thinking about whether it’s a good solution, but “good” is a matter of degree.)
Although the code you curated through the LLM may work, I do think — given its complexity — that it’s a bit of a kluge. It works , and shows that a solution is possible, but it is cumbersome and indirect.
If someone asks, “Is this possible?” the answer (in TiddlyWiki) is pretty much always “yes.” But if they ask, “How should I do this?” I think our goal should be to give people the conceptual tools they need so that they can solve similar problems, parsimoniously (elegantly).
There are lots of convoluted ways to get around the Dominant Append behavior, when one wants the opposite (that is, one wants to keep the earlier value when there are duplicates). In the past, I have tried workaround with a set of reverse[]
operations — to feed a “backwards” order into the de-duplication process, and then to re-reverse the order. Although that, too, works, I knew that was not the most elegant solution.
At any rate, my suggestion is that when you post something that was generated by a LLM process, and you don’t yourself understand how or why it works (and you therefore probably don’t understand whether it’s an efficient or flexible solution), please do be up-front about this fact, with a disclaimer such as “This code comes from LLM, but then I tested it, and it does seem to work”.
Still, I do think people would welcome this kind of tool. Sometimes we encounter one-off problems and are more interested in getting any solution that works, so we can move on with the larger tasks at hand.