A macro gives a title to reusable expression syntax. Expansion replaces a call
with its template before compilation. The expanded expression follows the
expression type and cost rules.
TRON371 B
Offset (hex) Bytes (hex) Meaning 000 54 52 4F 4E magic TRON 004 3C 616765 txt "age" 008 02 24000000000000
00 i64 36 011 0F 0A 04000000 0800
0000 map leaf, size 10: @4 → @8 01B 4C 726F6C65 txt "role" 020 8C 656E67696E6565
72 txt "engineer" 029 0F 0A 1B000000 2000
0000 map leaf, size 10: @1B → @20 033 4C 6E616D65 txt "name" 038 3C 416461 txt "Ada" 03C 0F 0A 33000000 3800
0000 map leaf, size 10: @33 → @38 046 07 12 00910000 1100
0000 29000000 3C00
0000 map branch, size 18, depth 0 (root), slots 8, 12, 15: @11 → @29 → @3C 058 5C 236C696E6B txt "#link" 05E 5C 235F616461 txt "#_ada" 064 0F 0A 58000000 5E00
0000 map leaf, size 10: @58 → @5E 06E 3C 616765 txt "age" 072 02 29000000000000
00 i64 41 07B 0F 0A 6E000000 7200
0000 map leaf, size 10: @6E → @72 085 6C 6D656E746F72 txt "mentor" 08C 0F 0A 85000000 6400
0000 map leaf, size 10: @85 → @64 096 4C 726F6C65 txt "role" 09B 8C 656E67696E6565
72 txt "engineer" 0A4 0F 0A 96000000 9B00
0000 map leaf, size 10: @96 → @9B 0AE 4C 6E616D65 txt "name" 0B3 3C 426F62 txt "Bob" 0B7 0F 0A AE000000 B300
0000 map leaf, size 10: @AE → @B3 0C1 07 16 00990000 7B00
0000 8C000000 A400
0000 B7000000 map branch, size 22, depth 0 (root), slots 8, 11, 12, 15: @7B → @8C → @A4 → @B7 0D7 3C 616765 txt "age" 0DB 02 1D000000000000
00 i64 29 0E4 0F 0A D7000000 DB00
0000 map leaf, size 10: @D7 → @DB 0EE 4C 726F6C65 txt "role" 0F3 8C 64657369676E65
72 txt "designer" 0FC 0F 0A EE000000 F300
0000 map leaf, size 10: @EE → @F3 106 4C 6E616D65 txt "name" 10B 2C 4379 txt "Cy" 10E 0F 0A 06010000 0B01
0000 map leaf, size 10: @106 → @10B 118 07 12 00910000 E400
0000 FC000000 0E01
0000 map branch, size 18, depth 0 (root), slots 8, 12, 15: @E4 → @FC → @10E 12A 4C 235F6379 txt "#_cy" 12F 0F 0A 2A010000 1801
0000 map leaf, size 10: @12A → @118 139 5C 235F626F62 txt "#_bob" 13F 0F 0A 39010000 C100
0000 map leaf, size 10: @139 → @C1 149 5C 235F616461 txt "#_ada" 14F 0F 0A 49010000 4600
0000 map leaf, size 10: @149 → @46 159 07 12 80210000 2F01
0000 3F010000 4F01
0000 map branch, size 18, depth 0 (root), slots 7, 8, 13: @12F → @13F → @14F
A macro document has ordered params and an expands template. An optional
description explains its purpose. A stored definition has a title. The native macro builder also accepts an authored definition without saving it.
TRON216 B
Offset (hex) Bytes (hex) Meaning 00 54 52 4F 4E magic TRON 04 6C 616D6F756E74 txt "amount" 0B 4C 72617465 txt "rate" 10 0E 11 00 0300 020000
00 04000000 0B0000
00 array leaf, size 17, shift 0, bitmap 0003, count 2 (root): @4 → @B 21 6C 696E73657274 txt "insert" 28 6C 616D6F756E74 txt "amount" 2F 0F 0A 21000000 2800
0000 map leaf, size 10: @21 → @28 39 6C 696E73657274 txt "insert" 40 4C 72617465 txt "rate" 45 0F 0A 39000000 4000
0000 map leaf, size 10: @39 → @40 4F 1C 2A txt "*" 51 0E 15 00 0700 030000
00 4F000000 2F0000
00 45000000 array leaf, size 21, shift 0, bitmap 0007, count 3 (root): @4F → @2F → @45 66 6C 706172616D73 txt "params" 6D 0F 0A 66000000 1000
0000 map leaf, size 10: @66 → @10 77 7C 657870616E6473 txt "expands" 7F 0F 0A 77000000 5100
0000 map leaf, size 10: @77 → @51 89 BC 64657363726970
74696F6E txt "description" 95 14 1D 4D756C746970
6C7920616E20616D
6F756E7420627920
6120726174652E txt "Multiply an amount by a …" B4 0F 0A 89000000 9500
0000 map leaf, size 10: @89 → @95 BE 07 12 00850000 6D00
0000 7F000000 B400
0000 map branch, size 18, depth 0 (root), slots 8, 10, 15: @6D → @7F → @B4
Parameter names are plain text. Each name must differ from the other names.
A name cannot be empty or contain whitespace. A macro cannot have a built-in operator's title. Definition
validation rejects unknown fields, missing required fields and invalid markers.
A call has the title first, then one argument for each declared parameter.
TRON72 B
Offset (hex) Bytes (hex) Meaning 00 54 52 4F 4E magic TRON 04 14 12 70726963696E
672F6170706C792D
72617465 txt "pricing/apply-rate" 18 9C 3F737562746F74
616C txt "?subtotal" 22 03 9A9999999999C9
3F f64 0.2 2B 0E 15 00 0700 030000
00 04000000 180000
00 22000000 array leaf, size 21, shift 0, bitmap 0007, count 3 (root): @4 → @18 → @22
TRON21 B
Offset (hex) Bytes (hex) Meaning 00 54 52 4F 4E magic TRON 04 03 00000000000034
40 f64 20
Expansion produces [* ?subtotal 0.2]. The variable remains a caller input.
Expansion rejects an invalid argument count.
TRON58 B
Offset (hex) Bytes (hex) Meaning 00 54 52 4F 4E magic TRON 04 14 12 70726963696E
672F6170706C792D
72617465 txt "pricing/apply-rate" 18 02 64000000000000
00 i64 100 21 0E 11 00 0300 020000
00 04000000 180000
00 array leaf, size 17, shift 0, bitmap 0003, count 2 (root): @4 → @18
An insertion marker is a map with one member. {insert name} replaces the
marker with one argument tree. {spread name} inserts each item of a list
argument into the surrounding list.
TRON124 B
Offset (hex) Bytes (hex) Meaning 00 54 52 4F 4E magic TRON 04 6C 76616C756573 txt "values" 0B 0E 0D 00 0100 010000
00 04000000 array leaf, size 13, shift 0, bitmap 0001, count 1 (root): @4 18 6C 737072656164 txt "spread" 1F 6C 76616C756573 txt "values" 26 0F 0A 18000000 1F00
0000 map leaf, size 10: @18 → @1F 30 1C 2B txt "+" 32 0E 11 00 0300 020000
00 30000000 260000
00 array leaf, size 17, shift 0, bitmap 0003, count 2 (root): @30 → @26 43 6C 706172616D73 txt "params" 4A 0F 0A 43000000 0B00
0000 map leaf, size 10: @43 → @B 54 7C 657870616E6473 txt "expands" 5C 0F 0A 54000000 3200
0000 map leaf, size 10: @54 → @32 66 07 0E 00050000 4A00
0000 5C000000 map branch, size 14, depth 0 (root), slots 8, 10: @4A → @5C
TRON98 B
Offset (hex) Bytes (hex) Meaning 00 54 52 4F 4E magic TRON 04 02 01000000000000
00 i64 1 0D 02 02000000000000
00 i64 2 16 02 03000000000000
00 i64 3 1F 02 04000000000000
00 i64 4 28 0E 19 00 0F00 040000
00 04000000 0D0000
00 16000000 1F0000
00 array leaf, size 25, shift 0, bitmap 000F, count 4 (root): @4 → @D → @16 → @1F 41 7C 73756D2D616C6C txt "sum-all" 49 0E 11 00 0300 020000
00 41000000 280000
00 array leaf, size 17, shift 0, bitmap 0003, count 2 (root): @41 → @28
TRON21 B
Offset (hex) Bytes (hex) Meaning 00 54 52 4F 4E magic TRON 04 02 0A000000000000
00 i64 10
The expansion is [+ 1 2 3 4]. A spread marker needs a surrounding list and a
list argument. An insertion preserves a list or map as one argument tree.
A template can call another macro. Expansion resolves nested calls before the
compiler validates operators and types. Expansion rejects direct and indirect cycles.
TRON160 B
Offset (hex) Bytes (hex) Meaning 00 54 52 4F 4E magic TRON 04 5C 76616C7565 txt "value" 0A 5C 666C6F6F72 txt "floor" 10 0E 11 00 0300 020000
00 04000000 0A0000
00 array leaf, size 17, shift 0, bitmap 0003, count 2 (root): @4 → @A 21 6C 696E73657274 txt "insert" 28 5C 76616C7565 txt "value" 2E 0F 0A 21000000 2800
0000 map leaf, size 10: @21 → @28 38 6C 696E73657274 txt "insert" 3F 5C 666C6F6F72 txt "floor" 45 0F 0A 38000000 3F00
0000 map leaf, size 10: @38 → @3F 4F 2C 3E3D txt ">=" 52 0E 15 00 0700 030000
00 4F000000 2E0000
00 45000000 array leaf, size 21, shift 0, bitmap 0007, count 3 (root): @4F → @2E → @45 67 6C 706172616D73 txt "params" 6E 0F 0A 67000000 1000
0000 map leaf, size 10: @67 → @10 78 7C 657870616E6473 txt "expands" 80 0F 0A 78000000 5200
0000 map leaf, size 10: @78 → @52 8A 07 0E 00050000 6E00
0000 80000000 map branch, size 14, depth 0 (root), slots 8, 10: @6E → @80
TRON222 B
Offset (hex) Bytes (hex) Meaning 00 54 52 4F 4E magic TRON 04 5C 76616C7565 txt "value" 0A 0E 0D 00 0100 010000
00 04000000 array leaf, size 13, shift 0, bitmap 0001, count 1 (root): @4 17 6C 696E73657274 txt "insert" 1E 5C 76616C7565 txt "value" 24 0F 0A 17000000 1E00
0000 map leaf, size 10: @17 → @1E 2E 8C 61742D6C656173
74 txt "at-least" 37 02 12000000000000
00 i64 18 40 0E 15 00 0700 030000
00 2E000000 240000
00 37000000 array leaf, size 21, shift 0, bitmap 0007, count 3 (root): @2E → @24 → @37 55 6C 696E73657274 txt "insert" 5C 5C 76616C7565 txt "value" 62 0F 0A 55000000 5C00
0000 map leaf, size 10: @55 → @5C 6C 1C 3C txt "<" 6E 02 41000000000000
00 i64 65 77 0E 15 00 0700 030000
00 6C000000 620000
00 6E000000 array leaf, size 21, shift 0, bitmap 0007, count 3 (root): @6C → @62 → @6E 8C 3C 616E64 txt "and" 90 0E 15 00 0700 030000
00 8C000000 400000
00 77000000 array leaf, size 21, shift 0, bitmap 0007, count 3 (root): @8C → @40 → @77 A5 6C 706172616D73 txt "params" AC 0F 0A A5000000 0A00
0000 map leaf, size 10: @A5 → @A B6 7C 657870616E6473 txt "expands" BE 0F 0A B6000000 9000
0000 map leaf, size 10: @B6 → @90 C8 07 0E 00050000 AC00
0000 BE000000 map branch, size 14, depth 0 (root), slots 8, 10: @AC → @BE
TRON50 B
Offset (hex) Bytes (hex) Meaning 00 54 52 4F 4E magic TRON 04 BC 776F726B696E67
2D616765 txt "working-age" 10 02 24000000000000
00 i64 36 19 0E 11 00 0300 020000
00 04000000 100000
00 array leaf, size 17, shift 0, bitmap 0003, count 2 (root): @4 → @10
TRON13 B
Offset (hex) Bytes (hex) Meaning 0 54 52 4F 4E magic TRON 4 09 bit true
quote stops macro expansion inside its values. The expression evaluator still
rejects quote. Syntax preserved during expansion is not necessarily executable.
A query expands macros in expression positions, including predicates,
derivations, computed columns, grouping filters, ordering and projection.
Ordinary fact values remain data.
TRON250 B
Offset (hex) Bytes (hex) Meaning 00 54 52 4F 4E magic TRON 04 5C 3F6E616D65 txt "?name" 0A 0E 0D 00 0100 010000
00 04000000 array leaf, size 13, shift 0, bitmap 0001, count 1 (root): @4 17 7C 3F706572736F6E txt "?person" 1F 3C 616765 txt "age" 23 4C 3F616765 txt "?age" 28 0E 15 00 0700 030000
00 17000000 1F0000
00 23000000 array leaf, size 21, shift 0, bitmap 0007, count 3 (root): @17 → @1F → @23 3D 7C 3F706572736F6E txt "?person" 45 4C 6E616D65 txt "name" 4A 5C 3F6E616D65 txt "?name" 50 0E 15 00 0700 030000
00 3D000000 450000
00 4A000000 array leaf, size 21, shift 0, bitmap 0007, count 3 (root): @3D → @45 → @4A 65 BC 776F726B696E67
2D616765 txt "working-age" 71 4C 3F616765 txt "?age" 76 0E 11 00 0300 020000
00 65000000 710000
00 array leaf, size 17, shift 0, bitmap 0003, count 2 (root): @65 → @71 87 0E 15 00 0700 030000
00 28000000 500000
00 76000000 array leaf, size 21, shift 0, bitmap 0007, count 3 (root): @28 → @50 → @76 9C 5C 3F6E616D65 txt "?name" A2 0E 0D 00 0100 010000
00 9C000000 array leaf, size 13, shift 0, bitmap 0001, count 1 (root): @9C AF 5C 7768657265 txt "where" B5 0F 0A AF000000 8700
0000 map leaf, size 10: @AF → @87 BF 4C 66696E64 txt "find" C4 0F 0A BF000000 0A00
0000 map leaf, size 10: @BF → @A CE 7C 6F726465724279 txt "orderBy" D6 0F 0A CE000000 A200
0000 map leaf, size 10: @CE → @A2 E0 07 12 2A000000 B500
0000 C4000000 D600
0000 map branch, size 18, depth 0 (root), slots 1, 3, 5: @B5 → @C4 → @D6
TRON89 B
Offset (hex) Bytes (hex) Meaning 00 54 52 4F 4E magic TRON 04 4C 6E616D65 txt "name" 09 3C 416461 txt "Ada" 0D 0F 0A 04000000 0900
0000 map leaf, size 10: @4 → @9 17 4C 6E616D65 txt "name" 1C 3C 426F62 txt "Bob" 20 0F 0A 17000000 1C00
0000 map leaf, size 10: @17 → @1C 2A 4C 6E616D65 txt "name" 2F 2C 4379 txt "Cy" 32 0F 0A 2A000000 2F00
0000 map leaf, size 10: @2A → @2F 3C 0E 15 00 0700 030000
00 0D000000 200000
00 32000000 array leaf, size 21, shift 0, bitmap 0007, count 3 (root): @D → @20 → @32
A mutation uses the same expansion rules in its selection query.
An unpinned call uses the current title mapping. Each accepted update records a
mapping revision. A pin names that mapping revision, rather than the macro
entity or its definition revision.
This update changes working-age to require an age of at least 40.
TRON216 B
Offset (hex) Bytes (hex) Meaning 00 54 52 4F 4E magic TRON 04 5C 76616C7565 txt "value" 0A 0E 0D 00 0100 010000
00 04000000 array leaf, size 13, shift 0, bitmap 0001, count 1 (root): @4 17 6C 696E73657274 txt "insert" 1E 5C 76616C7565 txt "value" 24 0F 0A 17000000 1E00
0000 map leaf, size 10: @17 → @1E 2E 2C 3E3D txt ">=" 31 02 28000000000000
00 i64 40 3A 0E 15 00 0700 030000
00 2E000000 240000
00 31000000 array leaf, size 21, shift 0, bitmap 0007, count 3 (root): @2E → @24 → @31 4F 6C 696E73657274 txt "insert" 56 5C 76616C7565 txt "value" 5C 0F 0A 4F000000 5600
0000 map leaf, size 10: @4F → @56 66 1C 3C txt "<" 68 02 41000000000000
00 i64 65 71 0E 15 00 0700 030000
00 66000000 5C0000
00 68000000 array leaf, size 21, shift 0, bitmap 0007, count 3 (root): @66 → @5C → @68 86 3C 616E64 txt "and" 8A 0E 15 00 0700 030000
00 86000000 3A0000
00 71000000 array leaf, size 21, shift 0, bitmap 0007, count 3 (root): @86 → @3A → @71 9F 6C 706172616D73 txt "params" A6 0F 0A 9F000000 0A00
0000 map leaf, size 10: @9F → @A B0 7C 657870616E6473 txt "expands" B8 0F 0A B0000000 8A00
0000 map leaf, size 10: @B0 → @8A C2 07 0E 00050000 A600
0000 B8000000 map branch, size 14, depth 0 (root), slots 8, 10: @A6 → @B8
TRON50 B
Offset (hex) Bytes (hex) Meaning 00 54 52 4F 4E magic TRON 04 BC 776F726B696E67
2D616765 txt "working-age" 10 02 24000000000000
00 i64 36 19 0E 11 00 0300 020000
00 04000000 100000
00 array leaf, size 17, shift 0, bitmap 0003, count 2 (root): @4 → @10
TRON13 B
Offset (hex) Bytes (hex) Meaning 0 54 52 4F 4E magic TRON 4 01 bit false
The first recorded mapping revision of working-age is 13 in this fresh
fixture. Read the actual revision from the saved definition in your database.
A pinned call keeps that earlier rule.
TRON115 B
Offset (hex) Bytes (hex) Meaning 00 54 52 4F 4E magic TRON 04 FC 6D617070696E67
5265766973696F6E txt "mappingRevision" 14 02 0D000000000000
00 i64 13 1D 0F 0A 04000000 1400
0000 map leaf, size 10: @4 → @14 27 5C 7469746C65 txt "title" 2D BC 776F726B696E67
2D616765 txt "working-age" 39 0F 0A 27000000 2D00
0000 map leaf, size 10: @27 → @2D 43 07 0E 08400000 1D00
0000 39000000 map branch, size 14, depth 0 (root), slots 3, 14: @1D → @39 51 02 24000000000000
00 i64 36 5A 0E 11 00 0300 020000
00 43000000 510000
00 array leaf, size 17, shift 0, bitmap 0003, count 2 (root): @43 → @51
TRON13 B
Offset (hex) Bytes (hex) Meaning 0 54 52 4F 4E magic TRON 4 09 bit true
A query can pin all calls of a title with its definitions member. Expansion
consumes that metadata before query compilation.
TRON307 B
Offset (hex) Bytes (hex) Meaning 000 54 52 4F 4E magic TRON 004 BC 776F726B696E67
2D616765 txt "working-age" 010 02 0D000000000000
00 i64 13 019 0F 0A 04000000 1000
0000 map leaf, size 10: @4 → @10 023 5C 3F6E616D65 txt "?name" 029 0E 0D 00 0100 010000
00 23000000 array leaf, size 13, shift 0, bitmap 0001, count 1 (root): @23 036 7C 3F706572736F6E txt "?person" 03E 3C 616765 txt "age" 042 4C 3F616765 txt "?age" 047 0E 15 00 0700 030000
00 36000000 3E0000
00 42000000 array leaf, size 21, shift 0, bitmap 0007, count 3 (root): @36 → @3E → @42 05C 7C 3F706572736F6E txt "?person" 064 4C 6E616D65 txt "name" 069 5C 3F6E616D65 txt "?name" 06F 0E 15 00 0700 030000
00 5C000000 640000
00 69000000 array leaf, size 21, shift 0, bitmap 0007, count 3 (root): @5C → @64 → @69 084 BC 776F726B696E67
2D616765 txt "working-age" 090 4C 3F616765 txt "?age" 095 0E 11 00 0300 020000
00 84000000 900000
00 array leaf, size 17, shift 0, bitmap 0003, count 2 (root): @84 → @90 0A6 0E 15 00 0700 030000
00 47000000 6F0000
00 95000000 array leaf, size 21, shift 0, bitmap 0007, count 3 (root): @47 → @6F → @95 0BB 5C 3F6E616D65 txt "?name" 0C1 0E 0D 00 0100 010000
00 BB000000 array leaf, size 13, shift 0, bitmap 0001, count 1 (root): @BB 0CE 5C 7768657265 txt "where" 0D4 0F 0A CE000000 A600
0000 map leaf, size 10: @CE → @A6 0DE 4C 66696E64 txt "find" 0E3 0F 0A DE000000 2900
0000 map leaf, size 10: @DE → @29 0ED 7C 6F726465724279 txt "orderBy" 0F5 0F 0A ED000000 C100
0000 map leaf, size 10: @ED → @C1 0FF BC 646566696E6974
696F6E73 txt "definitions" 10B 0F 0A FF000000 1900
0000 map leaf, size 10: @FF → @19 115 07 16 2A020000 D400
0000 E3000000 F500
0000 0B010000 map branch, size 22, depth 0 (root), slots 1, 3, 5, 9: @D4 → @E3 → @F5 → @10B
TRON89 B
Offset (hex) Bytes (hex) Meaning 00 54 52 4F 4E magic TRON 04 4C 6E616D65 txt "name" 09 3C 416461 txt "Ada" 0D 0F 0A 04000000 0900
0000 map leaf, size 10: @4 → @9 17 4C 6E616D65 txt "name" 1C 3C 426F62 txt "Bob" 20 0F 0A 17000000 1C00
0000 map leaf, size 10: @17 → @1C 2A 4C 6E616D65 txt "name" 2F 2C 4379 txt "Cy" 32 0F 0A 2A000000 2F00
0000 map leaf, size 10: @2A → @2F 3C 0E 15 00 0700 030000
00 0D000000 200000
00 32000000 array leaf, size 21, shift 0, bitmap 0007, count 3 (root): @D → @20 → @32
Expansion rejects an unknown mapping revision. It does not select the current rule.
build macro · expand macro .