Operators

An expression combines operators to calculate its result. Each operator defines its accepted arguments and result. The Arguments column gives argument names in their accepted order. Stardust rejects the wrong number of arguments. It also rejects an argument of the wrong type.

TRON371 B
Offset (hex)Bytes (hex)Meaning
00054 52 4F 4Emagic TRON
0043C 616765txt "age"
00802 24000000000000 00i64 36
0110F 0A 04000000 0800 0000map leaf, size 10: @4 → @8
01B4C 726F6C65txt "role"
0208C 656E67696E6565 72txt "engineer"
0290F 0A 1B000000 2000 0000map leaf, size 10: @1B → @20
0334C 6E616D65txt "name"
0383C 416461txt "Ada"
03C0F 0A 33000000 3800 0000map leaf, size 10: @33 → @38
04607 12 00910000 1100 0000 29000000 3C00 0000map branch, size 18, depth 0 (root), slots 8, 12, 15: @11 → @29 → @3C
0585C 236C696E6Btxt "#link"
05E5C 235F616461txt "#_ada"
0640F 0A 58000000 5E00 0000map leaf, size 10: @58 → @5E
06E3C 616765txt "age"
07202 29000000000000 00i64 41
07B0F 0A 6E000000 7200 0000map leaf, size 10: @6E → @72
0856C 6D656E746F72txt "mentor"
08C0F 0A 85000000 6400 0000map leaf, size 10: @85 → @64
0964C 726F6C65txt "role"
09B8C 656E67696E6565 72txt "engineer"
0A40F 0A 96000000 9B00 0000map leaf, size 10: @96 → @9B
0AE4C 6E616D65txt "name"
0B33C 426F62txt "Bob"
0B70F 0A AE000000 B300 0000map leaf, size 10: @AE → @B3
0C107 16 00990000 7B00 0000 8C000000 A400 0000 B7000000map branch, size 22, depth 0 (root), slots 8, 11, 12, 15: @7B → @8C → @A4 → @B7
0D73C 616765txt "age"
0DB02 1D000000000000 00i64 29
0E40F 0A D7000000 DB00 0000map leaf, size 10: @D7 → @DB
0EE4C 726F6C65txt "role"
0F38C 64657369676E65 72txt "designer"
0FC0F 0A EE000000 F300 0000map leaf, size 10: @EE → @F3
1064C 6E616D65txt "name"
10B2C 4379txt "Cy"
10E0F 0A 06010000 0B01 0000map leaf, size 10: @106 → @10B
11807 12 00910000 E400 0000 FC000000 0E01 0000map branch, size 18, depth 0 (root), slots 8, 12, 15: @E4 → @FC → @10E
12A4C 235F6379txt "#_cy"
12F0F 0A 2A010000 1801 0000map leaf, size 10: @12A → @118
1395C 235F626F62txt "#_bob"
13F0F 0A 39010000 C100 0000map leaf, size 10: @139 → @C1
1495C 235F616461txt "#_ada"
14F0F 0A 49010000 4600 0000map leaf, size 10: @149 → @46
15907 12 80210000 2F01 0000 3F010000 4F01 0000map branch, size 18, depth 0 (root), slots 7, 8, 13: @12F → @13F → @14F

More than two arguments

Operators that accept more than two arguments use a fold, a chain, or all arguments together.

A fold applies the operator again to its own result. +, -, * and / have this shape, and [+ 1 2 3] is [+ [+ 1 2] 3]. A fold goes from left to right, which changes the result of - and /.

TRON66 B
Offset (hex)Bytes (hex)Meaning
0054 52 4F 4Emagic TRON
041C 2Dtxt "-"
0602 14000000000000 00i64 20
0F02 05000000000000 00i64 5
1802 03000000000000 00i64 3
210E 19 00 0F00 040000 00 04000000 060000 00 0F000000 180000 00array leaf, size 25, shift 0, bitmap 000F, count 4 (root): @4 → @6 → @F → @18
TRON21 B
Offset (hex)Bytes (hex)Meaning
0054 52 4F 4Emagic TRON
0402 0C000000000000 00i64 12

xor has this shape. [xor a b c] is [xor [xor a b] c], and xor is therefore true when the number of true arguments cannot be divided by 2. Three true arguments give true.

TRON44 B
Offset (hex)Bytes (hex)Meaning
0054 52 4F 4Emagic TRON
043C 786F72txt "xor"
0809bit true
0909bit true
0A09bit true
0B0E 19 00 0F00 040000 00 04000000 080000 00 09000000 0A0000 00array leaf, size 25, shift 0, bitmap 000F, count 4 (root): @4 → @8 → @9 → @A
TRON13 B
Offset (hex)Bytes (hex)Meaning
054 52 4F 4Emagic TRON
409bit true

A chain applies the operator to each pair of adjacent arguments. <, <=, > >= and = have this shape. [< 1 5 10] requires 1 to be less than 5 and 5 to be less than 10. It does not compare a true or false value against 10.

TRON66 B
Offset (hex)Bytes (hex)Meaning
0054 52 4F 4Emagic TRON
041C 3Ctxt "<"
0602 01000000000000 00i64 1
0F02 05000000000000 00i64 5
1802 0A000000000000 00i64 10
210E 19 00 0F00 040000 00 04000000 060000 00 0F000000 180000 00array leaf, size 25, shift 0, bitmap 000F, count 4 (root): @4 → @6 → @F → @18
TRON13 B
Offset (hex)Bytes (hex)Meaning
054 52 4F 4Emagic TRON
409bit true

The other operators that accept more than two arguments use all of them together. min, max, concat and format have this shape.

Arithmetic

OperatorArgumentsResult
+, *numbers…Fold left. No arguments gives 0 or 1
-, /number, numbers…Fold left. Integer / truncates toward zero. Unary / gives the reciprocal with the input number type
-numberThe negative of the argument
remdividend, divisorThe remainder of the division. The result has the sign of the first argument
%dividend, divisorThe modulus of the division. The result has the sign of the second argument

All arguments must have the same number type. An integer with a float is an error. An integer result of more than 64 bits is an error. Division by zero is also an error. rem and % reject a divisor of zero in the same way.

TRON53 B
Offset (hex)Bytes (hex)Meaning
0054 52 4F 4Emagic TRON
041C 2Ftxt "/"
0602 01000000000000 00i64 1
0F02 00000000000000 00i64 0
180E 15 00 0700 030000 00 04000000 060000 00 0F000000array leaf, size 21, shift 0, bitmap 0007, count 3 (root): @4 → @6 → @F

Error

Runtime_Failure: The divisor must not be zero.

rem and % give the same result when both arguments are more than zero. The results are different when one argument is less than zero. rem keeps the sign of the first argument, and % keeps the sign of the second argument.

TRON122 B
Offset (hex)Bytes (hex)Meaning
0054 52 4F 4Emagic TRON
043C 72656Dtxt "rem"
0802 EFFFFFFFFFFFFF FFi64 -17
1102 05000000000000 00i64 5
1A0E 15 00 0700 030000 00 04000000 080000 00 11000000array leaf, size 21, shift 0, bitmap 0007, count 3 (root): @4 → @8 → @11
2F1C 25txt "%"
3102 EFFFFFFFFFFFFF FFi64 -17
3A02 05000000000000 00i64 5
430E 15 00 0700 030000 00 2F000000 310000 00 3A000000array leaf, size 21, shift 0, bitmap 0007, count 3 (root): @2F → @31 → @3A
584C 6C697374txt "list"
5D0E 15 00 0700 030000 00 58000000 1A0000 00 43000000array leaf, size 21, shift 0, bitmap 0007, count 3 (root): @58 → @1A → @43
TRON47 B
Offset (hex)Bytes (hex)Meaning
0054 52 4F 4Emagic TRON
0402 FEFFFFFFFFFFFF FFi64 -2
0D02 03000000000000 00i64 3
160E 11 00 0300 020000 00 04000000 0D0000 00array leaf, size 17, shift 0, bitmap 0003, count 2 (root): @4 → @D

Comparison and equality

OperatorArgumentsResult
<, <=, >, >=number, number, numbers…Exact comparison of numbers of one type. An integer with a float is an error
=value, value, values…All values equal. [= null null] is true. [= 1 1.0] is false
!=left, rightThe values differ
invalue, listTrue when the value equals (=) an item of the list. [in 2 [list 1 2.0]] is false
notvalueThe opposite true or false value
xorvalue, values…True when the number of true arguments cannot be divided by 2

Equality compares the type and the value. An integer never equals a float, also inside lists and maps. The float zeros -0.0 and 0.0 are equal, and each keeps its sign. Maps are equal when they have the same keys with equal values, in any order. A missing key is different from a key with the value null. Text compares character codes, without normalization. A function equals only itself: two functions made separately are different, even with the same definition.

JSON Schema validation follows Draft 7's separate decimal number model. It compares the mathematical decimal values in the schema and instance documents: 1 equals 1.0, and 0.1 differs from 0.10000000000000001. Schema integer accepts numbers with no fractional part, including 1.0. Validation preserves the input document and its native numeric types. Host, stored and computed values enter this view through their numeric document representation; validation does not reconstruct an earlier source spelling. Native floats without a fractional part use their exact decimal integer value with .0 when converted to a document. Other native floats use a shortest decimal representation, so native 0.1 enters the schema view as decimal 0.1.

TRON120 B
Offset (hex)Bytes (hex)Meaning
0054 52 4F 4Emagic TRON
041C 3Dtxt "="
0602 01000000000000 00i64 1
0F02 01000000000000 00i64 1
180E 15 00 0700 030000 00 04000000 060000 00 0F000000array leaf, size 21, shift 0, bitmap 0007, count 3 (root): @4 → @6 → @F
2D1C 3Dtxt "="
2F02 00000000000000 00i64 0
3802 00000000000000 00i64 0
410E 15 00 0700 030000 00 2D000000 2F0000 00 38000000array leaf, size 21, shift 0, bitmap 0007, count 3 (root): @2D → @2F → @38
564C 6C697374txt "list"
5B0E 15 00 0700 030000 00 56000000 180000 00 41000000array leaf, size 21, shift 0, bitmap 0007, count 3 (root): @56 → @18 → @41
TRON31 B
Offset (hex)Bytes (hex)Meaning
0054 52 4F 4Emagic TRON
0401bit false
0509bit true
060E 11 00 0300 020000 00 04000000 050000 00array leaf, size 17, shift 0, bitmap 0003, count 2 (root): @4 → @5

not and xor use the rule for true and false values: only null and false are false. xor counts the arguments that are true.

TRON47 B
Offset (hex)Bytes (hex)Meaning
0054 52 4F 4Emagic TRON
043C 786F72txt "xor"
0802 00000000000000 00i64 0
1101bit false
120E 15 00 0700 030000 00 04000000 080000 00 11000000array leaf, size 21, shift 0, bitmap 0007, count 3 (root): @4 → @8 → @11
TRON13 B
Offset (hex)Bytes (hex)Meaning
054 52 4F 4Emagic TRON
409bit true

Three arguments give a range test. < and > keep the value away from both limits. <= and >= accept the value at each limit.

TRON67 B
Offset (hex)Bytes (hex)Meaning
0054 52 4F 4Emagic TRON
042C 3C3Dtxt "<="
0702 01000000000000 00i64 1
1002 0A000000000000 00i64 10
1902 0A000000000000 00i64 10
220E 19 00 0F00 040000 00 04000000 070000 00 10000000 190000 00array leaf, size 25, shift 0, bitmap 000F, count 4 (root): @4 → @7 → @10 → @19
TRON13 B
Offset (hex)Bytes (hex)Meaning
054 52 4F 4Emagic TRON
409bit true

One operator gives the same type of limit on each side. If the two limits are not the same type, use and with two comparisons. This example accepts a value at the low limit but not at the high limit.

TRON120 B
Offset (hex)Bytes (hex)Meaning
0054 52 4F 4Emagic TRON
042C 3C3Dtxt "<="
0702 01000000000000 00i64 1
1002 01000000000000 00i64 1
190E 15 00 0700 030000 00 04000000 070000 00 10000000array leaf, size 21, shift 0, bitmap 0007, count 3 (root): @4 → @7 → @10
2E1C 3Ctxt "<"
3002 01000000000000 00i64 1
3902 0A000000000000 00i64 10
420E 15 00 0700 030000 00 2E000000 300000 00 39000000array leaf, size 21, shift 0, bitmap 0007, count 3 (root): @2E → @30 → @39
573C 616E64txt "and"
5B0E 15 00 0700 030000 00 57000000 190000 00 42000000array leaf, size 21, shift 0, bitmap 0007, count 3 (root): @57 → @19 → @42
TRON13 B
Offset (hex)Bytes (hex)Meaning
054 52 4F 4Emagic TRON
409bit true

Math

OperatorArgumentsResult
abs, incr, decrnumberThe absolute value, one more, or one less
incrWrap, decrWrapintegerOne more or one less, wrapped in 64 bits
floor, ceil, roundnumberThe number without its fraction
mean, medianlistThe average or the middle value of a list
min, maxnumber, numbers…The smallest or the largest value
clampvalue, low, highA value between a low and a high limit
lerpstart, end, fractionA value between two values
seededRandseed, seeds…The same float from 0 to 1 for the same arguments
powbase, exponentThe first number to the power of the second
sqrtnumberThe square root, a float
expnumbere to the power of the number, a float
log, log2numberThe natural or the base-2 logarithm, a float

min, max and clamp require numbers of one type: all integers or all floats, also inside the single list that min and max accept. Mixed types are an error; convert with toInt or toFloat first. The result is the selected number unchanged, so a whole float stays a float. A tie keeps the first number. clamp requires the low limit not to be greater than the high limit. All operands must be finite, including numbers that are not selected.

TRON211 B
Offset (hex)Bytes (hex)Meaning
0054 52 4F 4Emagic TRON
043C 6D6178txt "max"
0802 01000000000020 00i64 9007199254740993
1102 00000000000020 00i64 9007199254740992
1A0E 15 00 0700 030000 00 04000000 080000 00 11000000array leaf, size 21, shift 0, bitmap 0007, count 3 (root): @4 → @8 → @11
2F5C 636C616D70txt "clamp"
3502 01000000000000 00i64 1
3E02 00000000000000 00i64 0
4702 02000000000000 00i64 2
500E 19 00 0F00 040000 00 2F000000 350000 00 3E000000 470000 00array leaf, size 25, shift 0, bitmap 000F, count 4 (root): @2F → @35 → @3E → @47
697C 746F466C6F6174txt "toFloat"
7102 03000000000000 00i64 3
7A0E 11 00 0300 020000 00 69000000 710000 00array leaf, size 17, shift 0, bitmap 0003, count 2 (root): @69 → @71
8B3C 6D6178txt "max"
8F03 00000000000004 40f64 2.5
980E 15 00 0700 030000 00 8B000000 7A0000 00 8F000000array leaf, size 21, shift 0, bitmap 0007, count 3 (root): @8B → @7A → @8F
AD4C 6C697374txt "list"
B20E 19 00 0F00 040000 00 AD000000 1A0000 00 50000000 980000 00array leaf, size 25, shift 0, bitmap 000F, count 4 (root): @AD → @1A → @50 → @98
TRON60 B
Offset (hex)Bytes (hex)Meaning
0054 52 4F 4Emagic TRON
0402 01000000000020 00i64 9007199254740993
0D02 01000000000000 00i64 1
1602 03000000000000 00i64 3
1F0E 15 00 0700 030000 00 04000000 0D0000 00 16000000array leaf, size 21, shift 0, bitmap 0007, count 3 (root): @4 → @D → @16

pow gives an integer when both numbers are integers and the power is zero or more. Such a result must fit in 64 bits, as for *. Other powers give a float. sqrt requires a number that is not negative, and log and log2 require a number greater than zero. A result that is not finite is an error, as for /.

TRON249 B
Offset (hex)Bytes (hex)Meaning
0054 52 4F 4Emagic TRON
043C 706F77txt "pow"
0802 02000000000000 00i64 2
1102 0A000000000000 00i64 10
1A0E 15 00 0700 030000 00 04000000 080000 00 11000000array leaf, size 21, shift 0, bitmap 0007, count 3 (root): @4 → @8 → @11
2F3C 706F77txt "pow"
3302 02000000000000 00i64 2
3C02 FFFFFFFFFFFFFF FFi64 -1
450E 15 00 0700 030000 00 2F000000 330000 00 3C000000array leaf, size 21, shift 0, bitmap 0007, count 3 (root): @2F → @33 → @3C
5A4C 73717274txt "sqrt"
5F02 02000000000000 00i64 2
680E 11 00 0300 020000 00 5A000000 5F0000 00array leaf, size 17, shift 0, bitmap 0003, count 2 (root): @5A → @5F
794C 6C6F6732txt "log2"
7E02 00040000000000 00i64 1024
870E 11 00 0300 020000 00 79000000 7E0000 00array leaf, size 17, shift 0, bitmap 0003, count 2 (root): @79 → @7E
983C 657870txt "exp"
9C02 01000000000000 00i64 1
A50E 11 00 0300 020000 00 98000000 9C0000 00array leaf, size 17, shift 0, bitmap 0003, count 2 (root): @98 → @9C
B63C 6C6F67txt "log"
BA0E 11 00 0300 020000 00 B6000000 A50000 00array leaf, size 17, shift 0, bitmap 0003, count 2 (root): @B6 → @A5
CB4C 6C697374txt "list"
D00E 21 00 3F00 060000 00 CB000000 1A0000 00 45000000 680000 00 87000000 BA0000 00array leaf, size 33, shift 0, bitmap 003F, count 6 (root): @CB → @1A → @45 → @68 → @87 → @BA
TRON86 B
Offset (hex)Bytes (hex)Meaning
0054 52 4F 4Emagic TRON
0402 00040000000000 00i64 1024
0D03 000000000000E0 3Ff64 0.5
1603 CD3B7F669EA0F6 3Ff64 1.4142135623730951
1F02 0A000000000000 00i64 10
2802 01000000000000 00i64 1
310E 1D 00 1F00 050000 00 04000000 0D0000 00 16000000 1F0000 00 28000000array leaf, size 29, shift 0, bitmap 001F, count 5 (root): @4 → @D → @16 → @1F → @28

seededRand gives the same number for the same arguments on every machine and every run. A value that must be irregular but must not change between runs therefore needs no stored database field.

TRON140 B
Offset (hex)Bytes (hex)Meaning
0054 52 4F 4Emagic TRON
04AC 73656564656452 616E64txt "seededRand"
0F3C 616461txt "ada"
130E 11 00 0300 020000 00 04000000 0F0000 00array leaf, size 17, shift 0, bitmap 0003, count 2 (root): @4 → @F
24AC 73656564656452 616E64txt "seededRand"
2F3C 616461txt "ada"
330E 11 00 0300 020000 00 24000000 2F0000 00array leaf, size 17, shift 0, bitmap 0003, count 2 (root): @24 → @2F
44AC 73656564656452 616E64txt "seededRand"
4F5C 6772616365txt "grace"
550E 11 00 0300 020000 00 44000000 4F0000 00array leaf, size 17, shift 0, bitmap 0003, count 2 (root): @44 → @4F
664C 6C697374txt "list"
6B0E 19 00 0F00 040000 00 66000000 130000 00 33000000 550000 00array leaf, size 25, shift 0, bitmap 000F, count 4 (root): @66 → @13 → @33 → @55
TRON60 B
Offset (hex)Bytes (hex)Meaning
0054 52 4F 4Emagic TRON
0403 A1CFBF115A44EB 3Ff64 0.8520937296548149
0D03 A1CFBF115A44EB 3Ff64 0.8520937296548149
1603 EAA3B52A532EEA 3Ff64 0.8181548914118342
1F0E 15 00 0700 030000 00 04000000 0D0000 00 16000000array leaf, size 21, shift 0, bitmap 0007, count 3 (root): @4 → @D → @16

Text

OperatorArgumentsResult
concatvalue, values…The arguments as one text
lower, upper, trimtextThe text in one case, or without spaces at its ends
textLengthtextThe number of characters
camel, snake, screamingSnake, kebab, pascaltextThe text in one name style
escapetextThe text with HTML characters replaced
contains, hasPrefixpart, textTrue or false
hasSuffixtext, suffixTrue or false
trimPrefixprefix, textText without that prefix
trimSuffixtext, suffixText without that suffix
indexOf, lastIndexOfneedle, textOne-based character position, or 0
repeatcount, textThe text repeated
split, splitAfterseparator, textThe separator first, then the text
joinseparator, listThe separator first, then the list
replaceold, new, textThe old text, the new text, then the text
substringstart, text or start, size, textThe start, and an optional size. Both accept negative values
formattemplate, value, values…The template first, then its arguments

Stardust counts and cuts text in characters. [textLength héllo] gives 5.

contains, hasPrefix and hasSuffix give false when an argument is not a text, null included. [hasPrefix a 7] is false. The other text operators fail on a value that is not a text.

format uses {} in sequence and {0} by position. {{}} gives one brace.

A specification after : must suit the type of its value. An integer accepts b, c, d, o, x, X and U. A float accepts e, E, f, F, g and G, and a text accepts s. A float specification over an integer is an error, as [format '{:.2f}' 42] is.

TRON67 B
Offset (hex)Bytes (hex)Meaning
0054 52 4F 4Emagic TRON
046C 666F726D6174txt "format"
0BBC 7B313A2E31667D 207B307Dtxt "{1:.1f} {0}"
171C 61txt "a"
1903 00000000000004 40f64 2.5
220E 19 00 0F00 040000 00 04000000 0B0000 00 17000000 190000 00array leaf, size 25, shift 0, bitmap 000F, count 4 (root): @4 → @B → @17 → @19
TRON18 B
Offset (hex)Bytes (hex)Meaning
0054 52 4F 4Emagic TRON
045C 322E352061txt "2.5 a"

Collections

OperatorArgumentsResult
length, countlistThe number of items
first, last, rest, reverselistOne part of a list
nthlist, positionThe item at a zero-based position. Out of range is an error
takecount, listThe first items
consitem, listA list with the item at its start
appendfirst-list, second-listThe two lists joined
sumlistThe total of a list of numbers of one type
sort, uniq, flattenlistThe list in order, without repeats, or one level less deep
keys, values, toPairsmapThe parts of a map, in key order
fromPairspairsA map from pairs of name and value
getcollection, key or collection, key, defaultA map key or a list position, with an optional default

uniq keeps the first item of each group of equal (=) items.

TRON174 B
Offset (hex)Bytes (hex)Meaning
0054 52 4F 4Emagic TRON
044C 6C697374txt "list"
0902 02000000000000 00i64 2
120E 11 00 0300 020000 00 04000000 090000 00array leaf, size 17, shift 0, bitmap 0003, count 2 (root): @4 → @9
234C 6C697374txt "list"
2802 02000000000000 00i64 2
310E 11 00 0300 020000 00 23000000 280000 00array leaf, size 17, shift 0, bitmap 0003, count 2 (root): @23 → @28
424C 6C697374txt "list"
4702 02000000000000 00i64 2
5002 02000000000000 00i64 2
5902 00000000000000 00i64 0
6202 00000000000000 00i64 0
6B0E 25 00 7F00 070000 00 42000000 470000 00 50000000 120000 00 31000000 590000 00 62000000array leaf, size 37, shift 0, bitmap 007F, count 7 (root): @42 → @47 → @50 → @12 → @31 → @59 → @62
904C 756E6971txt "uniq"
950E 11 00 0300 020000 00 90000000 6B0000 00array leaf, size 17, shift 0, bitmap 0003, count 2 (root): @90 → @6B
TRON112 B
Offset (hex)Bytes (hex)Meaning
0054 52 4F 4Emagic TRON
0402 02000000000000 00i64 2
0D0E 0D 00 0100 010000 00 04000000array leaf, size 13, shift 0, bitmap 0001, count 1 (root): @4
1A02 02000000000000 00i64 2
230E 0D 00 0100 010000 00 1A000000array leaf, size 13, shift 0, bitmap 0001, count 1 (root): @1A
3002 02000000000000 00i64 2
3902 02000000000000 00i64 2
4202 00000000000000 00i64 0
4B0E 1D 00 1F00 050000 00 30000000 390000 00 0D000000 230000 00 42000000array leaf, size 29, shift 0, bitmap 001F, count 5 (root): @30 → @39 → @D → @23 → @42

get gives null for a missing key or position. Its third argument sets a different default. nth rejects a position outside the list.

Stardust sorts values of different types in this sequence: null, booleans, numbers, text, then collections. Integers and floats sort together by their exact values. An integer comes before a float with the same value.

TRON133 B
Offset (hex)Bytes (hex)Meaning
0054 52 4F 4Emagic TRON
044C 6C697374txt "list"
0902 01000000000000 00i64 1
121C 61txt "a"
1409bit true
1500nil
1603 00000000000004 40f64 2.5
1F02 02000000000000 00i64 2
2803 000000000000F8 3Ff64 1.5
3102 01000000000000 00i64 1
3A0E 2D 00 FF01 090000 00 04000000 090000 00 12000000 140000 00 15000000 160000 00 1F000000 280000 00 31000000array leaf, size 45, shift 0, bitmap 01FF, count 9 (root): @4 → @9 → @12 → @14 → @15 → @16 → @1F → @28 → @31
674C 736F7274txt "sort"
6C0E 11 00 0300 020000 00 67000000 3A0000 00array leaf, size 17, shift 0, bitmap 0003, count 2 (root): @67 → @3A
TRON102 B
Offset (hex)Bytes (hex)Meaning
0054 52 4F 4Emagic TRON
0400nil
0509bit true
0602 01000000000000 00i64 1
0F02 01000000000000 00i64 1
1803 000000000000F8 3Ff64 1.5
2102 02000000000000 00i64 2
2A03 00000000000004 40f64 2.5
331C 61txt "a"
350E 29 00 FF00 080000 00 04000000 050000 00 06000000 0F0000 00 18000000 210000 00 2A000000 330000 00array leaf, size 41, shift 0, bitmap 00FF, count 8 (root): @4 → @5 → @6 → @F → @18 → @21 → @2A → @33

Operators that use a function

Each operator in this group has a function first. The input list is last, including forms with an initial value or direction. A built-in operator can be a function, as in [reduce + 0 [list 1 2 3]].

OperatorArgumentsResult
map, filterfunction, listA new list
all, none, any, onefunction, listTrue when that number of items agree
find, findLastfunction, listThe first or last item that agrees, or null
findIndex, findLastIndexfunction, listZero-based position, or -1
groupByfunction, listA map from each calculated text key to its items
sortByfunction, list or function, direction, listThe list in the order of a calculated key, with an optional direction
reducefunction, initial, listThe function, the first value, then the list
count, sumfunction, listCounts or adds only the items that the function accepts
TRON164 B
Offset (hex)Bytes (hex)Meaning
0054 52 4F 4Emagic TRON
046C 3F76616C7565txt "?value"
0B0E 0D 00 0100 010000 00 04000000array leaf, size 13, shift 0, bitmap 0001, count 1 (root): @4
181C 3Etxt ">"
1A6C 3F76616C7565txt "?value"
2102 01000000000000 00i64 1
2A0E 15 00 0700 030000 00 18000000 1A0000 00 21000000array leaf, size 21, shift 0, bitmap 0007, count 3 (root): @18 → @1A → @21
3F2C 666Etxt "fn"
420E 15 00 0700 030000 00 3F000000 0B0000 00 2A000000array leaf, size 21, shift 0, bitmap 0007, count 3 (root): @3F → @B → @2A
574C 6C697374txt "list"
5C02 02000000000000 00i64 2
6502 03000000000000 00i64 3
6E0E 15 00 0700 030000 00 57000000 5C0000 00 65000000array leaf, size 21, shift 0, bitmap 0007, count 3 (root): @57 → @5C → @65
833C 616C6Ctxt "all"
870E 15 00 0700 030000 00 83000000 420000 00 6E000000array leaf, size 21, shift 0, bitmap 0007, count 3 (root): @83 → @42 → @6E
TRON13 B
Offset (hex)Bytes (hex)Meaning
054 52 4F 4Emagic TRON
409bit true

The groupBy key must be text, because it becomes a map key. Any other key is an error. toText changes a key to text explicitly, so the integer 7 and the text 7 then share one group.

TRON205 B
Offset (hex)Bytes (hex)Meaning
0054 52 4F 4Emagic TRON
042C 3F72txt "?r"
070E 0D 00 0100 010000 00 04000000array leaf, size 13, shift 0, bitmap 0001, count 1 (root): @4
143C 676574txt "get"
182C 3F72txt "?r"
1B4C 636F6465txt "code"
200E 15 00 0700 030000 00 14000000 180000 00 1B000000array leaf, size 21, shift 0, bitmap 0007, count 3 (root): @14 → @18 → @1B
356C 746F54657874txt "toText"
3C0E 11 00 0300 020000 00 35000000 200000 00array leaf, size 17, shift 0, bitmap 0003, count 2 (root): @35 → @20
4D2C 666Etxt "fn"
500E 15 00 0700 030000 00 4D000000 070000 00 3C000000array leaf, size 21, shift 0, bitmap 0007, count 3 (root): @4D → @7 → @3C
654C 636F6465txt "code"
6A02 07000000000000 00i64 7
730F 0A 65000000 6A00 0000map leaf, size 10: @65 → @6A
7D4C 636F6465txt "code"
821C 37txt "7"
840F 0A 7D000000 8200 0000map leaf, size 10: @7D → @82
8E4C 6C697374txt "list"
930E 15 00 0700 030000 00 8E000000 730000 00 84000000array leaf, size 21, shift 0, bitmap 0007, count 3 (root): @8E → @73 → @84
A87C 67726F75704279txt "groupBy"
B00E 15 00 0700 030000 00 A8000000 500000 00 93000000array leaf, size 21, shift 0, bitmap 0007, count 3 (root): @A8 → @50 → @93
TRON82 B
Offset (hex)Bytes (hex)Meaning
0054 52 4F 4Emagic TRON
044C 636F6465txt "code"
0902 07000000000000 00i64 7
120F 0A 04000000 0900 0000map leaf, size 10: @4 → @9
1C4C 636F6465txt "code"
211C 37txt "7"
230F 0A 1C000000 2100 0000map leaf, size 10: @1C → @21
2D0E 11 00 0300 020000 00 12000000 230000 00array leaf, size 17, shift 0, bitmap 0003, count 2 (root): @12 → @23
3E1C 37txt "7"
400F 0A 3E000000 2D00 0000map leaf, size 10: @3E → @2D

Type tests

isNull, isBool, isText, isInt, isFloat, isNumber, isEntity, isTagged, isList and isMap each have one argument. Each one gives true or false. isInt and isFloat separate the two kinds of number. isNumber accepts both kinds.

Type changes

OperatorArgumentsResult
toIntvalueAn integer from an integer, float, boolean or integer text
toFloatvalueA float from a float, integer or number text
toTextvalueText for any value. Lists and maps give JSON
toBoolvalueA boolean from a boolean, 'true', 'false', 1 or 0

A value that an operator cannot change gives an error. There is no fallback value. Expressions gives the full rules.

TRON39 B
Offset (hex)Bytes (hex)Meaning
0054 52 4F 4Emagic TRON
045C 746F496E74txt "toInt"
0A3C 342E30txt "4.0"
0E0E 11 00 0300 020000 00 04000000 0A0000 00array leaf, size 17, shift 0, bitmap 0003, count 2 (root): @4 → @A

Error

Runtime_Failure: Cannot change a value of type text into an integer.

Digests

OperatorArgumentsResult
hashvalueThe SHA-256 digest of the value, as a digest map

Stardust calculates the digest from the JSON form of the value, with map keys in order. The float zeros -0.0 and 0.0 give the same digest. The digest of a function comes from its definition and the values that it captures, and Stardust does not call the function. Two functions made separately from the same definition and values have the same digest but are not equal (=). The result is a {#sha256 …} map with hexadecimal digest text.

TRON36 B
Offset (hex)Bytes (hex)Meaning
0054 52 4F 4Emagic TRON
044C 68617368txt "hash"
091C 61txt "a"
0B0E 11 00 0300 020000 00 04000000 090000 00array leaf, size 17, shift 0, bitmap 0003, count 2 (root): @4 → @9
TRON96 B
Offset (hex)Bytes (hex)Meaning
0054 52 4F 4Emagic TRON
047C 23736861323536txt "#sha256"
0C14 40 616338643833 3432626262323336 3264313366306135 3539613336323162 6234303730313133 3638383935313634 6236323861353466 3766633333666334 3363txt "ac8d8342bbb2362d13f0a559…"
4E0F 0A 04000000 0C00 0000map leaf, size 10: @4 → @C

Regular expressions

OperatorArgumentsResult
reMatchpattern, textTrue when the pattern matches the text
reFindpattern, textMatched text, or null when no match exists
reReplacepattern, replacement, textThe text with each match replaced

The pattern is first. reReplace has the replacement second and input text last. An empty match gives empty text. An absent match gives null.

TRON71 B
Offset (hex)Bytes (hex)Meaning
0054 52 4F 4Emagic TRON
047C 72654D61746368txt "reMatch"
0C14 10 5E636174616C 6F672D5B302D395D 2B24txt "^catalog-[0-9]+$"
1EBC 636174616C6F67 2D313731txt "catalog-171"
2A0E 15 00 0700 030000 00 04000000 0C0000 00 1E000000array leaf, size 21, shift 0, bitmap 0007, count 3 (root): @4 → @C → @1E
TRON13 B
Offset (hex)Bytes (hex)Meaning
054 52 4F 4Emagic TRON
409bit true

reReplace changes every match. In the replacement, $1 to $9 are the groups that the pattern captured. $0 is the whole match. $ is one dollar sign.

TRON110 B
Offset (hex)Bytes (hex)Meaning
0054 52 4F 4Emagic TRON
049C 72655265706C61 6365txt "reReplace"
0E14 20 285B302D395D 7B347D292D285B30 2D395D7B327D292D 285B302D395D7B32 7D29txt "([0-9]{4})-([0-9]{2})-([…"
308C 24332F24322F24 31txt "$3/$2/$1"
3914 12 736869707065 6420323032362D30 392D3138txt "shipped 2026-09-18"
4D0E 19 00 0F00 040000 00 04000000 0E0000 00 30000000 390000 00array leaf, size 25, shift 0, bitmap 000F, count 4 (root): @4 → @E → @30 → @39
TRON32 B
Offset (hex)Bytes (hex)Meaning
0054 52 4F 4Emagic TRON
0414 12 736869707065 642031382F30392F 32303236txt "shipped 18/09/2026"

A pattern can start and end with / to add flags. The i flag ignores case. The m flag lets ^ and $ match at each line. The x flag ignores spaces in the pattern. The u flag reads the text as Unicode.

TRON54 B
Offset (hex)Bytes (hex)Meaning
0054 52 4F 4Emagic TRON
047C 72654D61746368txt "reMatch"
0C8C 2F5E414441242F 69txt "/^ADA$/i"
153C 616461txt "ada"
190E 15 00 0700 030000 00 04000000 0C0000 00 15000000array leaf, size 21, shift 0, bitmap 0007, count 3 (root): @4 → @C → @15
TRON13 B
Offset (hex)Bytes (hex)Meaning
054 52 4F 4Emagic TRON
409bit true

The pattern language

A pattern accepts alternation a|b and classes [0-9] and [^0-9]. It also accepts the ASCII shorthands \d \s \w and their negations. The wildcard is .. Repeats use *, +, ?, or {1,2}, with ? for non-greedy matching. Groups use (a) or (?:a). Anchors are ^ and $, and word boundaries are \b and \B.

A pattern can have 9 groups. Stardust rejects a pattern with more groups. It also rejects group references such as \1, look-ahead (?=a), look-behind (?<=a), and group names such as (?<year>a).

TRON53 B
Offset (hex)Bytes (hex)Meaning
0054 52 4F 4Emagic TRON
047C 72654D61746368txt "reMatch"
0C7C 283F3D666F6F29txt "(?=foo)"
143C 666F6Ftxt "foo"
180E 15 00 0700 030000 00 04000000 0C0000 00 14000000array leaf, size 21, shift 0, bitmap 0007, count 3 (root): @4 → @C → @14

Error

Runtime_Failure: The regular expression is not valid.

Matching examines each text position one time. It does not try each choice again, so the following expression gives false immediately: [reMatch (a+)+$ aaaaaaaaaaaaaaaaaaaaaaaa!].

TRON370 B
Offset (hex)Bytes (hex)Meaning
00054 52 4F 4Emagic TRON
0041C 2Btxt "+"
0060E 0D 00 0100 010000 00 04000000array leaf, size 13, shift 0, bitmap 0001, count 1 (root): @4
0131C 2Atxt "*"
0150E 0D 00 0100 010000 00 13000000array leaf, size 13, shift 0, bitmap 0001, count 1 (root): @13
0221C 2Ftxt "/"
02402 02000000000000 00i64 2
02D0E 11 00 0300 020000 00 22000000 240000 00array leaf, size 17, shift 0, bitmap 0003, count 2 (root): @22 → @24
03E1C 2Ftxt "/"
04002 02000000000000 00i64 2
0490E 11 00 0300 020000 00 3E000000 400000 00array leaf, size 17, shift 0, bitmap 0003, count 2 (root): @3E → @40
05A1C 3Dtxt "="
05C02 03000000000000 00i64 3
06502 03000000000000 00i64 3
06E02 03000000000000 00i64 3
0770E 19 00 0F00 040000 00 5A000000 5C0000 00 65000000 6E0000 00array leaf, size 25, shift 0, bitmap 000F, count 4 (root): @5A → @5C → @65 → @6E
0904C 6C697374txt "list"
09502 01000000000000 00i64 1
09E02 02000000000000 00i64 2
0A702 03000000000000 00i64 3
0B00E 19 00 0F00 040000 00 90000000 950000 00 9E000000 A70000 00array leaf, size 25, shift 0, bitmap 000F, count 4 (root): @90 → @95 → @9E → @A7
0C96C 726564756365txt "reduce"
0D01C 2Btxt "+"
0D202 00000000000000 00i64 0
0DB0E 19 00 0F00 040000 00 C9000000 D00000 00 D2000000 B00000 00array leaf, size 25, shift 0, bitmap 000F, count 4 (root): @C9 → @D0 → @D2 → @B0
0F46C 726546696E64txt "reFind"
0FB1C 7Atxt "z"
0FD3C 616263txt "abc"
1010E 15 00 0700 030000 00 F4000000 FB0000 00 FD000000array leaf, size 21, shift 0, bitmap 0007, count 3 (root): @F4 → @FB → @FD
1166C 726546696E64txt "reFind"
11D1C 5Etxt "^"
11F3C 616263txt "abc"
1230E 15 00 0700 030000 00 16010000 1D0100 00 1F010000array leaf, size 21, shift 0, bitmap 0007, count 3 (root): @116 → @11D → @11F
1384C 6C697374txt "list"
13D0E 2D 00 FF01 090000 00 38010000 060000 00 15000000 2D0000 00 49000000 770000 00 DB000000 010100 00 23010000array leaf, size 45, shift 0, bitmap 01FF, count 9 (root): @138 → @6 → @15 → @2D → @49 → @77 → @DB → @101 → @123
TRON101 B
Offset (hex)Bytes (hex)Meaning
0054 52 4F 4Emagic TRON
0402 00000000000000 00i64 0
0D02 01000000000000 00i64 1
1602 00000000000000 00i64 0
1F03 000000000000E0 3Ff64 0.5
2809bit true
2902 06000000000000 00i64 6
3200nil
330Ctxt ""
340E 29 00 FF00 080000 00 04000000 0D0000 00 16000000 1F0000 00 28000000 290000 00 32000000 330000 00array leaf, size 41, shift 0, bitmap 00FF, count 8 (root): @4 → @D → @16 → @1F → @28 → @29 → @32 → @33

Run it

build · program evaluate.