Functions.md
PuduLangLog.Expressions.Functions
type: module path: "@root/src/PuduLangLog/Expressions/Functions.pudu" fidelity: Active grammar: "[[grammar/pudu]]" depth_score: 0.6 depth_status: MEDIUM tags: [module, expressions] aliases: [PuduLangLog.Expressions.Functions]
Purpose
The built-in functions: text search and slicing, regular expressions, Length, ElementAt, TypeOf, TagOf, ToString, Round, Coalesce, IsDefined, Undefined, Now, UtcDateTime, Nest, and Inspect.
Interface
Signatures
export fn isKnown(name: Str) -> Bool
export fn call(name: Str, arguments: &Array[Option[Log.Value]], ignoring: Bool, now: &Log.Timestamp) -> Option[Log.Value]
export fn elementAt(target: &Log.Value, key: &Log.Value, ignoring: Bool) -> Option[Log.Value]Linkage
- Requires: [[src/PuduLangLog]], [[src/PuduLangLog/Domain/Properties]], [[src/PuduLangLog/Expressions/Values]],
Std.Decimal,Std.List,Std.Math,Std.Option,Std.Regex,Std.Text. - Consumed by: [[src/PuduLangLog/Expressions/Evaluator]] and [[src/PuduLangLog/Expressions]].
Algorithm
- Names are matched in lower case;
isKnownanswers for compile-time checks. - An undefined argument makes the call undefined, except for
Coalesce,IsDefined,TypeOf,Undefined, andNow. cilowers both sides of text comparisons and lowers a pattern's literal letters while keeping its escapes.TypeOfnames scalars by their Pudu type and collections asarray,object, ordictionary; an undefined argument isundefined.
Negative Logic (Prohibited Paths)
- A regular expression that does not compile is undefined, never an error.
Edge Cases
Substringwith a start past the end is undefined.
Depth
DEPTH 0.6 (MEDIUM). Tested by test/PuduLangLog/ExpressionsTest.
Grill Log
- Q: Why does
TypeOfaccept undefined? A: Asking whether something is missing is the question most filters on optional properties ask. _Rejected:_ undefined in, undefined out, which makes the check impossible.
Referenced by
[[CHANGELOG]] · [[src/PuduLangLog/_MOC]] · [[src/PuduLangLog/Expressions]] · [[src/PuduLangLog/Expressions/Evaluator]] · [[src/PuduLangLog/Expressions/Values]] · [[subsystems/Expressions]]
