Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
d801435
chore: 104256: improve tlisp function docs (esp types) for primitives
FlufflesTheMicrosaur Jul 20, 2025
ba95a64
Merge remote-tracking branch 'origin/master' into chore/104256-fix_tl…
FlufflesTheMicrosaur Jul 22, 2025
fbf6d95
chore: 104256: improve non-bugged edgecase documentation
FlufflesTheMicrosaur Jul 23, 2025
25c2ff4
Merge branch 'master' into chore/104256-fix_tlisp_math_docs
FlufflesTheMicrosaur Nov 25, 2025
24e7f81
Merge branch 'master' into chore/104256-fix_tlisp_math_docs
FlufflesTheMicrosaur Nov 26, 2025
359859d
fix: 104256: initial implementation of repr-style consistent handling…
FlufflesTheMicrosaur Nov 26, 2025
762e0c4
feat: 104256: add comparability operators (?= ...) (?== ...) (?=== ..…
FlufflesTheMicrosaur Nov 27, 2025
1731582
fix: 104256: fix regression due to copypaste error, moved enum to fix…
FlufflesTheMicrosaur Nov 27, 2025
5c4f840
chore: 104256: add some unit tests
FlufflesTheMicrosaur Nov 27, 2025
9ef453f
fix: 104256: fix a number of issues and add a basic version of strPat…
FlufflesTheMicrosaur Nov 27, 2025
47f8a17
fix: 104256: fixed inequality functions to correctly return true if a…
FlufflesTheMicrosaur Nov 27, 2025
fb73f36
Merge branch 'integration/API58' into fix/104256-fix_inconsistent_com…
FlufflesTheMicrosaur Nov 27, 2025
c1808d5
chore: 104256: add coercion compatibility functions to the docs
FlufflesTheMicrosaur Nov 27, 2025
56aae38
Merge branch 'integration/API58' into fix/104256-fix_inconsistent_com…
FlufflesTheMicrosaur Dec 11, 2025
434a33c
chore: 104256: add some more tests
FlufflesTheMicrosaur Dec 11, 2025
13219e7
Merge remote-tracking branch 'origin/integration/API59' into fix/1042…
FlufflesTheMicrosaur Jan 3, 2026
9f785af
chore: 104256: retarget on API59, update docs
FlufflesTheMicrosaur Jan 3, 2026
c6ab60f
Merge remote-tracking branch 'origin/integration/API59' into fix/1042…
FlufflesTheMicrosaur Jan 13, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
100 changes: 76 additions & 24 deletions Alchemy/CodeChain/DefPrimitives.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,37 +5,81 @@
static PRIMITIVEPROCDEF g_DefPrimitives[] =
{
{ "<", fnEqualityNumerals, FN_EQUALITY_LESSER,
"(< [x1 x2 ... xn]) -> True if x1 < x2 < ... < xn",
"(< [x1 x2 ... xn]) -> True if x1 < x2 < ... < xn\n"
"Nil is treated as the lowest possible value\n"
"Strings will be converted to ints or floats as appropriate",
NULL, 0, },

{ "ls", fnEquality, FN_EQUALITY_LESSER,
"(ls [x1 x2 ... xn]) -> True if x1 < x2 < ... < xn",
"(ls [x1 x2 ... xn]) -> True if x1 < x2 < ... < xn\n"
"Nil is treated as 0",
NULL, 0, },

{ "<=", fnEqualityNumerals, FN_EQUALITY_LESSER_EQ,
"(<= [x1 x2 ... xn]) -> True if x1 <= x2 <= ... <= xn",
"(<= [x1 x2 ... xn]) -> True if x1 <= x2 <= ... <= xn\n"
"Nil is treated as the lowest possible value\n"
"Strings will be converted to ints or floats as appropriate",
NULL, 0, },

{ "leq", fnEquality, FN_EQUALITY_LESSER_EQ,
"(leq [x1 x2 ... xn]) -> True if x1 <= x2 <= ... <= xn",
"(leq [x1 x2 ... xn]) -> True if x1 <= x2 <= ... <= xn\n"
"Nil is treated as 0",
NULL, 0, },

{ ">", fnEqualityNumerals, FN_EQUALITY_GREATER,
"(> [x1 x2 ... xn]) -> True if x1 > x2 > ... > xn",
"(> [x1 x2 ... xn]) -> True if x1 > x2 > ... > xn\n"
"Nil is treated as the lowest possible value\n"
"Strings will be converted to ints or floats as appropriate",
NULL, 0, },

{ "gr", fnEquality, FN_EQUALITY_GREATER,
"(gr [x1 x2 ... xn]) -> True if x1 > x2 > ... > xn",
"(gr [x1 x2 ... xn]) -> True if x1 > x2 > ... > xn\n"
"Nil is treated as 0",
NULL, 0, },

{ ">=", fnEqualityNumerals, FN_EQUALITY_GREATER_EQ,
"(>= [x1 x2 ... xn]) -> True if x1 >= x2 >= ... >= xn",
"(>= [x1 x2 ... xn]) -> True if x1 >= x2 >= ... >= xn\n"
"Nil is treated as the lowest possible value\n"
"Strings will be converted to ints or floats as appropriate",
NULL, 0, },

{ "geq", fnEquality, FN_EQUALITY_GREATER_EQ,
"(geq [x1 x2 ... xn]) -> True if x1 >= x2 >= ... >= xn",
"(geq [x1 x2 ... xn]) -> True if x1 >= x2 >= ... >= xn\n"
"Nil is treated as 0",
NULL, 0, },

{ "?=", fnEqualityNumerals, FN_EQUALITY_COMPARABLE,
"(?= [x1 x2 ... xn]) -> True if all arguments can be compared with fully type-coercing comparators.\n\n"
"Fully type-coercing comparators include:\n"
" (= ...)\n"
" (!= ...)\n"
" (> ...)\n"
" (>= ...)\n"
" (< ...)\n"
" (<= ...)\n"
"If false, fully type-coercing comparators other than (!= ...) will always return false for these inputs.",
NULL, 0, },

{ "?==", fnEquality, FN_EQUALITY_COMPARABLE,
"(?== [x1 x2 ... xn]) -> True if all arguments can be compared with compatible type-coercing comparators.\n\n"
"Compatible type-coercing comparators include:\n"
" (eq ...)\n"
" (neq ...)\n"
" (gr ...)\n"
" (geq ...)\n"
" (ls ...)\n"
" (leq ...)\n"
"If false, compatible type-coercing comparators other than (neq ...) will always return false for these inputs.",
NULL, 0, },

{ "?===", fnEqualityExact, FN_EQUALITY_COMPARABLE,
"(?=== [x1 x2 ... xn]) -> True if all arguments can be compared with non type-coercing comparators.\n\n"
"Non type-coercing comparators include:\n"
" (=== ...)\n"
" (!=== ...)\n"
"If false, non type-coercing comparators other than (!=== ...) will always return false for these inputs.",
NULL, 0, },

{ "add", fnMathListOld, FN_MATH_ADD,
"(add x1 [x2 ... xn]) -> sum (after converting arguments to int32)",
"v*", 0, },
Expand Down Expand Up @@ -141,11 +185,14 @@ static PRIMITIVEPROCDEF g_DefPrimitives[] =
"s", 0, },

{ "eq", fnEquality, FN_EQUALITY_EQ,
"(eq [x1 x2 ... xn]) -> True if all arguments are equal",
"(eq [x1 x2 ... xn]) -> True if all arguments are equal\n"
"Nil is treated as 0",
NULL, 0, },

{ "=", fnEqualityNumerals, FN_EQUALITY_EQ,
"(= [x1 x2 ... xn]) -> True if all arguments are equal",
"(= [x1 x2 ... xn]) -> True if all arguments are equal\n"
"Nil is not equal to 0, only to itself,\n"
"Strings will be converted to ints or floats as appropriate",
NULL, 0, },

{ "===", fnEqualityExact, FN_EQUALITY_EQ,
Expand Down Expand Up @@ -247,6 +294,7 @@ static PRIMITIVEPROCDEF g_DefPrimitives[] =

{ "join", fnItem, FN_JOIN,
"(join list [separator]) -> Concatenates items of list into a string, with separator in between each.\n"
"Ignores Nil elements\n"
"(join list 'oxfordComma) -> 'a' ; 'a and b' ; 'a, b, and c' ; etc.",
"v*", 0, },

Expand Down Expand Up @@ -330,19 +378,20 @@ static PRIMITIVEPROCDEF g_DefPrimitives[] =
"*", 0, },

{ "multiply", fnMathListOld, FN_MATH_MULTIPLY,
"(multiply x1 x2 ... xn) -> z",
"(multiply x1 x2 ... xn) -> z (int32 after converting all args to int32)",
"v*", 0, },

{ "*", fnMathList, FN_MATH_MULTIPLY,
"(* x1 x2 ... xn) -> z",
"(* x1 x2 ... xn) -> z (int32 if all args are int32, else real)",
"v*", 0, },

{ "neq", fnEquality, FN_EQUALITY_NEQ,
"(neq x1 x2 ... xn) -> True if any arguments are not equal",
NULL, 0, },

{ "!=", fnEqualityNumerals, FN_EQUALITY_NEQ,
"(!= x1 x2 ... xn) -> True if any arguments are not equal",
"(!= x1 x2 ... xn) -> True if any arguments are not equal\n"
"Supports comparisons between additional types",
NULL, 0, },

{ "!===", fnEqualityExact, FN_EQUALITY_NEQ,
Expand All @@ -362,19 +411,21 @@ static PRIMITIVEPROCDEF g_DefPrimitives[] =
NULL, 0, },

{ "power", fnMathFractions, FN_MATH_POWER,
"(power x y) -> z",
"(power x y) -> z (int32)\n"
"Supports fractional arguments by passing a list of 2 elements for x and y\n"
"where element 0 is the numerator and element 1 is the denominator.",
"vv", 0, },

{ "pow", fnMathNumerals, FN_MATH_POWER_NUMERALS,
"(pow x y) -> z",
"(pow x y) -> z (real)",
"nn", 0, },

{ "regex", fnRegEx, 0,
"(regex source pattern ['offset|'subex]) -> result",
"ss*", 0, },

{ "round", fnMathNumerals, FN_MATH_ROUND,
"(round ['stochastic] x) -> y",
"(round ['stochastic] x) -> y (int32)",
"*n", 0, },

{ "quote", fnSpecial, FN_QUOTE,
Expand Down Expand Up @@ -431,7 +482,7 @@ static PRIMITIVEPROCDEF g_DefPrimitives[] =
"l", 0, },

{ "sin", fnMathNumerals, FN_MATH_SIN,
"(sin x ['degrees]) -> z",
"(sin x ['degrees]) -> z (real)",
"n*", 0, },

{ "sort", fnSort, FN_SORT,
Expand All @@ -441,15 +492,16 @@ static PRIMITIVEPROCDEF g_DefPrimitives[] =
"v*", 0, },

{ "split", fnSplit, 0,
"(split string [characters]) -> list",
"(split string [characters]) -> list\n"
"multiple characters in a string each count as a separate delimiter",
"s*", 0, },

{ "sqrt", fnMath, FN_MATH_SQRT,
"(sqrt x) -> integer z",
"(sqrt x) -> z (int32)",
"v", 0, },

{ "sqrtn", fnMathNumerals, FN_MATH_SQRT_NUMERALS,
"(sqrtn x) -> real z",
"(sqrtn x) -> z (real)",
"n", 0, },

{ "strBeginsWith", fnStr, FN_STR_BEGINS_WITH,
Expand Down Expand Up @@ -520,11 +572,11 @@ static PRIMITIVEPROCDEF g_DefPrimitives[] =
"s*", PPFLAG_SIDEEFFECTS, },

{ "subtract", fnMathOld, FN_MATH_SUBTRACT,
"(subtract x1 x2 ... xn) -> z",
"(subtract x1 x2 ... xn) -> z (int32)",
NULL, 0, },

{ "-", fnMathList, FN_MATH_SUBTRACT,
"(- x1 x2 ... xn) -> z\n (- x) -> -x",
"(- x1 x2 ... xn) -> z\n (- x) -> -x (int32 or real)",
"v*", 0, },

{ "switch", fnSwitch, 0,
Expand All @@ -541,7 +593,7 @@ static PRIMITIVEPROCDEF g_DefPrimitives[] =
{ "sysTicks", fnSysInfo, FN_SYSINFO_TICKS, "(sysTicks) -> int", NULL, 0, },

{ "tan", fnMathNumerals, FN_MATH_TAN,
"(tan x ['degrees]) -> z",
"(tan x ['degrees]) -> z (real)",
"n*", 0, },

{ "typeOf", fnItem, FN_ITEM_TYPE,
Expand All @@ -555,7 +607,7 @@ static PRIMITIVEPROCDEF g_DefPrimitives[] =
" 'list\n"
" 'nil\n"
" 'primitive\n"
" 'real\n"
" 'real (double)\n"
" 'string\n"
" 'struct\n"
" 'true",
Expand Down
Loading