Page 1 of 1

Spells for In-Place List Editing

Posted: Fri Dec 02, 2022 1:01 am
by Robotgiggle
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.

Code: Select all

Rotation Gambit II
Dioscuri Gambit
Numerical Reflection: 1
Additive Distillation
Prospector's Gambit
Abacus Purification
Selection Exaltation
Rotation Gambit II
Numerical Reflection: 0
Jester's Gambit
Selection Exaltation
Rotation Gambit II
Combination Distillation
Combination Distillation
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.

Code: Select all

Numerical Reflection: 21
Swindler's Gambit
Gemini Decomposition
Rotation Gambit
Prospector's Gambit
Abacus Purification
Selection Exaltation
Rotation Gambit II
Numerical Reflection: 0
Rotation Gambit
Selection Exaltation
Rotation Gambit II
Combination Distillation
Combination Distillation

Re: Spells for In-Place List Editing

Posted: Mon Dec 05, 2022 12:21 am
by gchpaco
Versions using Alfinwy's renderer:

Robo's Scalpel
list, num, list → list

Rotation Gambit IIDioscuri GambitNumerical Reflection: 1Additive DistillationProspector's GambitAbacus PurificationSelection ExaltationRotation Gambit IINumerical Reflection: 0Jester's GambitSelection ExaltationRotation Gambit IICombination DistillationCombination Distillation

Advanced Scalpel
list, num, num, list → list

Huginn's GambitRotation GambitGemini DecompositionRotation GambitProspector's GambitAbacus PurificationSelection ExaltationRotation Gambit IINumerical Reflection: 0Rotation GambitSelection ExaltationMuninn's ReflectionCombination DistillationJester's GambitCombination Distillation

Re: Spells for In-Place List Editing

Posted: Fri Dec 09, 2022 7:14 pm
by gchpaco
A convenience for printing these out to find offsets. Uses Counter's Queue. Probably needs modification for spells > 64 in length.

Print Listing

IntrospectionGemini DecompositionAbacus Purification
begin Counter's Queue
Flock's ReflectionFlock's GambitRetrograde PurificationSpeaker's DecompositionJester's GambitMuninn's ReflectionSpeaker's DistillationHuginn's GambitIntrospectionFlock's ReflectionRetrospectionNumerical Reflection: 0Selection DistillationJester's GambitGemini GambitFlock's ReflectionFlock's GambitHermes' GambitFlock's ReflectionFlock's GambitMuninn's ReflectionSpeaker's DecompositionHuginn's GambitJester's GambitSpeaker's DistillationRetrograde PurificationFlock's DisintegrationJester's GambitHuginn's Gambit
end Counter's Queue
IntrospectionGemini DecompositionMuninn's ReflectionJester's GambitSelection DistillationNumerical Reflection: 2Flock's GambitRevealRetrospection
Jester's GambitThoth's Gambit
Retrospection

Re: Spells for In-Place List Editing

Posted: Fri Dec 09, 2022 7:25 pm
by Robotgiggle
Could you explain what that is for in a bit more detail? What exactly does it print out?

Re: Spells for In-Place List Editing

Posted: Fri Dec 09, 2022 7:33 pm
by gchpaco
This is it running on itself.

Code: Select all

[0.00, HexPattern(EAST aadaa)]
[1.00, HexPattern(EAST aqaeaq)]
[2.00, HexPattern(NORTH_WEST qwaeawqaeaqa)]
[3.00, HexPattern(SOUTH_WEST ewdqdwe)]
[4.00, HexPattern(EAST qqqaede)]
[5.00, HexPattern(SOUTH_WEST aaqwqaa)]
[6.00, HexPattern(EAST aawdd)]
[7.00, HexPattern(NORTH_EAST qeewdweddw)]
[8.00, HexPattern(SOUTH_EAST ddewedd)]
[9.00, HexPattern(NORTH_WEST eqqwawqaaw)]
[10.00, HexPattern(WEST qqq)]
[11.00, HexPattern(NORTH_WEST qwaeawqaeaqa)]
[12.00, HexPattern(EAST eee)]
[13.00, HexPattern(SOUTH_EAST aqaa)]
[14.00, HexPattern(NORTH_WEST deeed)]
[15.00, HexPattern(EAST aawdd)]
[16.00, HexPattern(EAST aadaadaa)]
[17.00, HexPattern(NORTH_WEST qwaeawqaeaqa)]
[18.00, HexPattern(SOUTH_WEST ewdqdwe)]
[19.00, HexPattern(SOUTH_EAST deaqq)]
[20.00, HexPattern(NORTH_WEST qwaeawqaeaqa)]
[21.00, HexPattern(SOUTH_WEST ewdqdwe)]
[22.00, HexPattern(NORTH_EAST qeewdweddw)]
[23.00, HexPattern(SOUTH_WEST aaqwqaa)]
[24.00, HexPattern(NORTH_WEST eqqwawqaaw)]
[25.00, HexPattern(EAST aawdd)]
[26.00, HexPattern(SOUTH_EAST ddewedd)]
[27.00, HexPattern(EAST qqqaede)]
[28.00, HexPattern(NORTH_WEST qwaeawq)]
[29.00, HexPattern(EAST aawdd)]
[30.00, HexPattern(NORTH_WEST eqqwawqaaw)]
[31.00, HexPattern(WEST qqq)]
[32.00, HexPattern(EAST aadaa)]
[33.00, HexPattern(NORTH_EAST qeewdweddw)]
[34.00, HexPattern(EAST aawdd)]
[35.00, HexPattern(NORTH_WEST deeed)]
[36.00, HexPattern(SOUTH_EAST aqaawa)]
[37.00, HexPattern(SOUTH_WEST ewdqdwe)]
[38.00, HexPattern(NORTH_EAST de)]
[39.00, HexPattern(EAST eee)]
[40.00, HexPattern(EAST aawdd)]
[41.00, HexPattern(NORTH_EAST dadad)]

Re: Spells for In-Place List Editing

Posted: Mon Dec 12, 2022 6:16 am
by Robotgiggle
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?

Numerical Reflection: 0 Huginn's Gambit Introspection Muninn's Reflection Gemini Decomposition Rotation Gambit Numerical Reflection: 2 Flock's Gambit Reveal Bookkeeper's Gambit: Drop 1 Numerical Reflection: 1 Additive Distillation Huginn's Gambit Retrospection Jester's Gambit Thoth's Gambit

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, listlist
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.)
dedqdewqaeaq

Code: Select all

#define Locator's Scalpel (EAST dedqdewqaeaq) = list, pattern, list -> list
{
    Rotation Gambit II
    Prospector's Gambit
    Jester's Gambit
    Locator's Distillation

    Dioscuri Gambit
    Numerical Reflection: 1
    Additive Distillation
    Prospector's Gambit
    Abacus Purification
    Selection Exaltation

    Rotation Gambit II
    Numerical Reflection: 0
    Jester's Gambit
    Selection Exaltation

    Rotation Gambit II
    Combination Distillation
    Combination Distillation
}
qqqddqddaaeddaawdddedqdeaadadaawNumerical Reflection: 1waawaaeddaqaeaqqaeaqwdedddqddNumerical Reflection: 0aawddqaeaqwdedddqddqaeaqqaeaqeee