Chatting like it's 1999! An open forum to discuss Hexcasting, and anything else made by petrak@'s mods, and also anything else else https://forum.petra-k.at/
A while ago, I made some spells for performing complex edits on lists without having to manually unpack them and shuffle around the iotas. The new stack manipulation patterns in 0.10 allow these spells to be much shorter and more efficient, so I decided to rewrite and repost them. Hopefully these will be helpful for all your spell-editing needs.
Robo's Scalpel list, num, list → list
Works just like Surgeon's Exaltation, but replaces the given index in the first list with the flattened content of the second list. Mainly intended for modifying spells, but you can probably find some other interesting uses.
Advanced Scalpel list, num, num, list → list
A more powerful version of the above spell. Replaces all the items in the first list between the two provided indices (lower bound inclusive, upper bound exclusive) with the flattened content of the second list.
Oh, so it prints each pattern in the provided spell along with its index. Why do you need Counter's Queue for that? Couldn't you just do it like this using thoth and an incrementing number?
Re: Spells for In-Place List Editing
Posted: Mon Dec 12, 2022 5:03 pm
by gchpaco
Yeah, actually that would probably be easier now that the recursion limit is 512; when it was still 64, CQ was helpful as part of an unrolling gambit.
Locator's Scalpel
Posted: Wed Jan 25, 2023 9:39 pm
by [object Object]
Locator's Scalpel list, pattern, list → list
Modified version of Robo's Scalpel that takes a pattern instead of an index, and replaces the first index of that pattern in the first list with the contents of the second list. (As with the original, does not fail gracefully.)