Macro Megathread

Post your coolest Hexcasting creations here.

New topics are NOT for chatting or asking help, put those in the comments of a post or in a different forum.
User avatar
beholderface
Posts: 37
Joined: Tue Dec 06, 2022 10:46 pm

Re: Macro Megathread

Post by beholderface »

Cubic Exaltation
Vec, Vec, VecBool

Takes three position vectors, returns a bool based on whether the first one is inside of (or exactly at the edge of) a cuboid defined by the second and third ones.
Consumes three meta-evals.

Edit: New version because I forgot to test it when you have anything other than the macro's arguments on the stack, which made it fuck up. New version fixes this.

qqqqqae
Patterns
qeeeeeNumerical Reflection: 4ddadqeeeeeNumerical Reflection: 50qaawddeNumerical Reflection: 2ewdqdweddqddNumerical Reflection: 2ewdqdweNumerical Reflection: 22qaawddeNumerical Reflection: 2ewdqdweNumerical Reflection: 0ddeweddddqddNumerical Reflection: 2ddeweddaawddNumerical Reflection: 1ddeweddaawddNumerical Reflection: 3ewdqdweqqqqwaeawqaadadaaweqqqaawddBookkeeper's Gambit: Keep 1eeeqwaeawqawdddeaqqNumerical Reflection: 4ddadqeeeeeNumerical Reflection: 3ewdqdweNumerical Reflection: 4ddaddeeedddqaaeeddqddqqwdwqwaeawqaeaqaewdqdweqqqaedeNumerical Reflection: 0deeedeeeaawdddadadqwaeawqwdwwdwBookkeeper's Gambit: Drop 1, Keep 1

Code: Select all

Vector Disintegration
Numerical Reflection: 4
Fisherman's Gambit
Vector Disintegration
Numerical Reflection: 50
Swindler's Gambit
Numerical Reflection: 2
Flock's Gambit
Rotation Gambit II
Numerical Reflection: 2
Flock's Gambit
Numerical Reflection: 22
Swindler's Gambit
Numerical Reflection: 2
Flock's Gambit
Numerical Reflection: 0
Speaker's Distillation
Rotation Gambit II
Numerical Reflection: 2
Speaker's Distillation
Jester's Gambit
Numerical Reflection: 1
Speaker's Distillation
Jester's Gambit
Numerical Reflection: 3
Flock's Gambit
{
    Flock's Disintegration
    Dioscuri Gambit
    Maximus Distillation
    {
        Jester's Gambit
        Bookkeeper's Gambit: -
    }
    Flock's Disintegration
    Augur's Exaltation
    Hermes' Gambit
    Numerical Reflection: 4
    Fisherman's Gambit
    Vector Disintegration
    Numerical Reflection: 3
    Flock's Gambit
    Numerical Reflection: 4
    Fisherman's Gambit
    Selection Distillation
    Undertaker's Gambit
    Maximus Distillation II
    Rotation Gambit II
    Minimus Distillation II
    Conjunction Distillation
    Flock's Reflection
    Flock's Gambit
    Retrograde Purification
    Numerical Reflection: 0
    Selection Distillation
}
Jester's Gambit
Thoth's Gambit
Flock's Disintegration
Conjunction Distillation
Conjunction Distillation
Bookkeeper's Gambit: v-
Last edited by beholderface on Thu Aug 31, 2023 6:41 pm, edited 1 time in total.
Argitechno
Posts: 3
Joined: Wed Aug 02, 2023 8:45 pm

Re: Macro Megathread

Post by Argitechno »

qeeeeeNumerical Reflection: 3ewdqdweddqddqeeeeeNumerical Reflection: 3ewdqdweddqddqeeeeeNumerical Reflection: 3ewdqdweddqddqaeaqqaeaqNumerical Reflection: 113Numerical Reflection: 2wedewNumerical Reflection: 227waawqaawddeqqqaedeqwaeawqaawddaaeddqeeedaqqqaqdwaNumerical Reflection: 7ewdqdweqqqaedeaaqwqaaaawddqqqaedeqwaeawqaawddaaeddqddqddqdwaNumerical Reflection: 5ewdqdweqqqaedeaaqwqaaaawddqqqaedeqwaeawqaawddaaeddqddqddqdwawdwwdw
Haven't tested, should work the same but with no meta-eval.
User avatar
Snazz
Posts: 8
Joined: Wed Dec 14, 2022 11:34 pm

Re: Macro Megathread

Post by Snazz »

I was briefly poking through and I noticed two macros that could be done in a different way to save patterns:

Sign Purification

Code: Select all

{
    Vector Reflection Zero
    Additive Distillation
    Axial Purification
    Vector Disintegration
    Bookkeeper's Gambit: v-v
}
Angular Distillation

Code: Select all

{
    Dioscuri Gambit
    Length Purification
    Jester's Gambit
    Length Purification
    Multiplicative Distillation
    Division Distillation

    Multiplicative Distillation
    Inverse Cosine Purification
}
A pattern can also be saved in Cartographer's Purification, but it isn't really that significant

Code: Select all

{
    Comma Reflection
    Separation Distillation
    Flock's Disintegration

    Input Purification
    Rotation Gambit
    Input Purification
    Rotation Gambit
    Input Purification
    Rotation Gambit

    Vector Exaltation
}
I'm surprised that we don't have these yet
Focal Reflection:

Code: Select all

{
    Mind's Reflection
    Compass' Purification
    Mind's Reflection
    Alidade's Purification
    Archer's Distillation
}
Focal Reflection II:

Code: Select all

{
    Mind's Reflection
    Compass' Purification
    Mind's Reflection
    Alidade's Purification
    Dioscuri Gambit

    Archer's Distillation
    Rotation Gambit II
    Architect's Distillation
    Additive Distillation
}
User avatar
Anna
Posts: 1
Joined: Tue Nov 21, 2023 10:34 am

Filtering Distillation

Post by Anna »

List of patterns, ListList

Very similar to Thoth's gambit. For each element of the second list, run the patterns from the first. If the top element of the stack would be true, keep the element. If the top element of the stack would be false, drop it. Uses one meta-eval. The list of patterns used as a filter must preserve the ravenmind.

Code: Select all

Jester's Gambit
{
  Bookkeeper's Gambit: v-
  Gemini Decomposition
  Huginn's Gambit
}
Jester's Gambit
Combination Distillation
{
  Flock's Reflection
  Flock's Gambit
  Retrograde Purification
  Numerical Reflection: 0
  Selection Distillation
  Muninn's Reflection
  Jester's Gambit
  {
    Bookkeeper's Gambit: -
    Bookkeeper's Gambit: v
  }
  Flock's Disintegration
  Augur's Exaltation
  Hermes' Gambit
}
Combination Distillation
Jester's Gambit
Muninn's Reflection
Rotation Gambit II
Thoth's Gambit
Jester's Gambit
Huginn's Gambit
Edit: removed considerations, and fixed a small oversight (missing the bookkeepers v-). Also, Thank you for rendering out the old version. If you notice this, please edit
Last edited by Anna on Wed Nov 22, 2023 3:07 pm, edited 2 times in total.
gchpaco
Posts: 7
Joined: Sun Dec 04, 2022 11:39 pm

Re: Macro Megathread

Post by gchpaco »

aawdd qqq aadaa eqqwawqaaw eee aawdd qaeaq qqq qwaeawqaeaqa ewdqdwe qqqaede Numerical Reflection: 0 deeed qeewdweddw aawdd qqqaw Bookkeeper's Gambit: Keep 1 qqqaw Bookkeeper's Gambit: Drop 1 aw deaqq eee qaeaq aawdd qeewdweddw ddqdd dadad aawdd eqqwawqaaw

Apologies, apparently macro encoding changed at some point?
User avatar
[object Object]
Posts: 70
Joined: Fri Dec 02, 2022 12:37 am

Discoverer's Distillation II

Post by [object Object] »

Discoverer's Distillation II
str, strnum
Removes two strings from the top of the stack, and returns the last index of the first string where the second string is a substring (ie. Discoverer's Distillation searches from the left, this searches from the right).
edwwedwe
Patterns
qqqaadadaawwaqaeaqaawddwaqaeaqaawddwddwddqddedwedeqqqaedewdwewdwdwaawddedwedeqqqaedewdwewdwdwaawddwaqwwaqaaadaaNumerical Reflection: 0eeddqddNumerical Reflection: 5wdedwwddwNumerical Reflection: -1awddeee

Code: Select all

#define Discoverer's Distillation II (WEST edwwedwe) = str, str -> num
// like Discoverer's Distillation, but returns the first occurrence from the right side (ie. rfind)
{
    // len(string) - len(pattern)
    Dioscuri Gambit
    Length Distillation: Str
    Jester's Gambit
    Length Distillation: Str

    Jester's Gambit
    Subtractive Distillation
    Rotation Gambit II

    // rindex
    Separation Purification
    Retrograde Purification
    Scrivener's Purification II
    
    Jester's Gambit
    Separation Purification
    Retrograde Purification
    Scrivener's Purification II
    
    Jester's Gambit
    Discoverer's Distillation

    // discoverer >= 0 ? index : -1
    Gemini Decomposition
    Numerical Reflection: 0
    Maximus Distillation II
    Rotation Gambit II
    
    // len(string) - len(pattern) - rindex
    Numerical Reflection: 5 // len('"a", ')
    Division Distillation
    Subtractive Distillation

    Numerical Reflection: -1

    Augur's Exaltation
}
Helpers

Separation Purification
str[str]
Splits a string into a list of individual characters, removing the garbage empty strings that show up when just using Separation Distillation for this.
edwede
Patterns
qqqawdwaaqwaqaawdwaadeeedddqaaqaeaqdwaeaqaeee

Code: Select all

#define Separation Purification (WEST edwede) = str -> [str]
// split a string into individual characters with the empty string stripped
{
    Blank Reflection
    Separation Distillation
    
    Blank Reflection
    Single's Purification

    Undertaker's Gambit
    Combination Distillation
    Exclusionary Distillation
}
Scrivener's Purification II
liststr
["a", "b"] -> '"a", "b"'
wdwewdwdw
Patterns
qqqwawqwawawNumerical Reflection: 1aaeddwaqaeaqNumerical Reflection: 1wddwaqwwaqwaadeee

Code: Select all

#define Scrivener's Purification II (NORTH_WEST wdwewdwdw) = list -> str
// ["a", "b"] -> '"a", "b"'
{
    Scrivener's Purification
    
    Numerical Reflection: 1
    
    Prospector's Gambit
    Length Distillation: Str
    Numerical Reflection: 1
    Subtractive Distillation
    
    Winnowing Distillation
}
User avatar
[object Object]
Posts: 70
Joined: Fri Dec 02, 2022 12:37 am

Toroidal Selection Gambit

Post by [object Object] »

Toroidal Selection Gambit
[any], numany, any, any

Selects the iotas before, at, and after the given index. Wraps around at the edges.

qaeaqweeeee
Patterns
qqqaadadaawNumerical Reflection: 1wddwaaeddaqaeaqddqaawaawaawddaddwaaddeeedddqddaadadaawdeeedddqddNumerical Reflection: 1waawaaeddaqaeaqaddwaaddeeedeee

Code: Select all

#define Toroidal Selection Gambit (nw qaeaqweeeee) = [any, ...], num -> any, any, any
// data, i -> data[i-1], data[i], data[i+1]
// wraps around at the edges
{
    // data[(i - 1 + n) % n]
    Dioscuri Gambit
    Numerical Reflection: 1
    Subtractive Distillation

    Prospector's Gambit
    Abacus Purification
    Undertaker's Gambit
    Additive Distillation

    Jester's Gambit
    Modulus Distillation
    Selection Distillation

    // data[i]
    Rotation Gambit II
    Dioscuri Gambit
    Selection Distillation
    
    // data[(i + 1) % n]
    Rotation Gambit II
    Numerical Reflection: 1
    Additive Distillation
    
    Prospector's Gambit
    Abacus Purification
    Modulus Distillation
    Selection Distillation
}
Melon
Posts: 1
Joined: Fri Dec 15, 2023 12:46 am

Re: Macro Megathread

Post by Melon »

Binary Purification
numlist
Macros: Quinio
Converts a decimal (base 10) number to a list representing a binary (base 2) number.
edde

Code: Select all

#define Binary Purification (WEST edde) = num -> list
{
    {
        Numerical Reflection: 2
        Dioscuri Gambit
        Modulus Distillation
        Gemini Decomposition
        Numerical Reflection: 1
        Equality Distillation
        Numerical Reflection: 16
        Swindler's Gambit
        Division Distillation
        Jester's Gambit
        {
            Numerical Reflection: 0.5
            Subtractive Distillation
        }
        Vacant Reflection
        Augur's Exaltation
        Hermes' Gambit
        Gemini Decomposition
        Numerical Reflection: 1
        Equality Distillation
        Jester's Gambit
        Gemini Decomposition
        Numerical Reflection: 0
        Equality Distillation
        Rotation Gambit
        Jester's Gambit
        Undertaker's Gambit
        {
            Rotation Gambit
            Bookkeeper's Gambit: v
        }
        Vacant Reflection
        Augur's Exaltation
        Hermes' Gambit
        Disjunction Distillation
        {
            Charon's Gambit
        }
        Flock's Disintegration
        Vacant Reflection
        Augur's Exaltation
        Hermes' Gambit
    }
    Quinio
    Flock's Reflection
    Flock's Gambit
}
User avatar
Dashkal
Posts: 1
Joined: Tue Dec 19, 2023 10:47 pm

Split List

Post by Dashkal »

Split List
list, numlist, list
Splits a list into two lists at the specified position
qaeaqwdedq
Patterns
aadadaaw Numerical Reflection: 0 aawdd qaeaqwded ddqdd aaedd aqaeaq qaeaqwded

Code: Select all

#define Split List (NORTH_WEST qaeaqwdedq) = list, num -> list, list
{
    Dioscuri Gambit
    Numerical Reflection: 0
    Jester's Gambit
    Selection Exaltation
    Rotation Gambit II
    Prospector's Gambit
    Abacus Purification
    Selection Exaltation
}
Example:

Code: Select all

{
    {
       Embed:  <[ "a", "b", "c", "d" ]>
    }
    Flock's Disintegration
    Numerical Reflection: 3
    Split List
}
Would result in

Code: Select all

[ "a", "b", "c" ], ["d"]
User avatar
[object Object]
Posts: 70
Joined: Fri Dec 02, 2022 12:37 am

Inverse Tangent Distillation

Post by [object Object] »

Inverse Tangent Distillation
num, numnum
Implements atan2() (specifically the "variant [...] that avoids [the] inflated rounding errors" on this page). Kristi Fristi posted a similar macro in this thread a while ago, but this version takes 12 fewer patterns and actually works.
Note: atan2(0, 0) will result in a "divide 0 by 0" mishap, but that value is undefined anyway, so I think that's reasonable.
qdaqqqqqw
Patterns
qqqaadadaawNumerical Reflection: 0qqaawddawaadadaawdwwdwddqddwdwNumerical Reflection: 16qaawddewqaqwaadadaawNumerical Reflection: 0eqqqqqwqaqwwaawaaeaaqqqaawddBookkeeper's Gambit: Keep 1eeeqwaeawqawdddeaqqwdedweadeeeeewNumerical Reflection: 2waqawqdwdqaawddawddeee

Code: Select all

#define Inverse Tangent Distillation (WEST qdaqqqqqw) = num, num -> num
// y, x -> atan2(y, x)
{
    Dioscuri Gambit
    Numerical Reflection: 0
    Minimus Distillation II
    
    Jester's Gambit
    Augur's Purification
    
    Dioscuri Gambit
    Negation Purification
    Conjunction Distillation

    Rotation Gambit II
    Conjunction Distillation
    
    Numerical Reflection: 16
    Swindler's Gambit

    Length Purification
    
    Dioscuri Gambit
    Numerical Reflection: 0
    Vector Exaltation
    Length Purification

    Additive Distillation
    
    Rotation Gambit
    {
        Jester's Gambit
        Bookkeeper's Gambit: -
    }
    Flock's Disintegration
    Augur's Exaltation
    Hermes' Gambit

    Division Distillation
    Inverse Tangent Purification
    Numerical Reflection: 2
    Multiplicative Distillation
    
    Arc's Reflection
    Jester's Gambit
    Augur's Exaltation
}