Appearance
Operators
In Arden Syntax, operators are special keywords or symbols that perform actions on your data. This section covers several key categories, from comparing values, to working with dates, to summarizing entire lists.
Arithmetic Operators
Arithmetic operators in Arden work just like basic math you learned in school. You can perform addition +, subtraction -, multiplication *, division /, and even exponentiation **.
Arden also provides rounding functions:
ROUNDrounds to the nearest integer,FLOORrounds down to the nearest integer,CEILINGrounds up to the nearest integer,TRUNCATEremoves any fractional part of a number
arden-syntax
logic:
roundVal := ROUND 7.6; // 8
floorVal := FLOOR 7.6; // 7
ceilVal := CEILING 7.6; // 8
truncVal := TRUNCATE 7.6; // 7Comparison Operators
Comparison operators in Arden Syntax let you check whether values match, differ, or fall within a range. They always return a truth value or null. or null if the comparison is undefined.
You can use either the symbolic or the more readable linguistic forms. Both are equivalent:
=, "is equal",eqfor short<>, "not equal", or shortne>, "is greater than">=, "is greater or equal than" or shortge<, "is less than"<=, "is less than or equal than"le
arden-syntax
logic:
a := 5;
b := 10;
isEqual := (a = b); // false
isNotEqual := (a <> b); // true
isGreater := (a > b); // false
isLessOrEqual := (a <= b); // trueAT MOST & AT LEAST
Arden Syntax also allows checking how many conditions in a set are true using AT LEAST or AT MOST. This is particularly useful for fuzzy logic or scoring risk based on multiple criteria, like in the example below.
arden-syntax
data:
bpDiastolic_mmHg := 50;
heartRate_bpm := 110;
gcs := 12;
hypotension := fuzzy set (40, truth value 1), (50, truth value 0.8), (60, truth value 0.1);
tachycardia := fuzzy set (90, truth value 0.3), (110, truth value 0.8), (130, truth value 1);
alteredConsciousness := fuzzy set (6, truth value 1), (9, truth value 0.9), (12, truth value 0.5), (15, truth value 0);
;;
priority: 50;;
evoke: ;;
logic:
septicShockRisk := AT LEAST 2 FROM (
bpDiastolic_mmHg is in hypotension,
heartRate_bpm is in tachycardia,
gcs is in alteredConsciousness
);
lowSepticShockRisk := AT MOST 1 FROM (
bpDiastolic_mmHg is in hypotension,
heartRate_bpm is in tachycardia,
gcs is in alteredConsciousness
);
conclude true;
;;
action:
return septicShockRisk, lowSepticShockRisk;
;;Here, all the symptoms fall into the fuzzy set definitions to some degree, which means both of your categorizations (septicShockRisk, lowSepticShockRisk) are true to some degree.
Temporal Operators
Temporal operators in Arden Syntax are used for reasoning about time, such as checking whether an event occurred before or after another event, or calculating durations between times. They are often combined with comparison operators to build complex time-based logic.
AfterandBefore, to check if a time occurs after or before another timeAgo, which subtracts a duration from now, resulting in a timeextract [year, month, day] from time, extracts a specific component of a date-time, e.g.EXTRACT YEAR 1990-01-03T14:23:17.3will result in 1990.
Example:
arden-syntax
data:
DOB := "1973-11-02T12:34:56" AS TIME;
age_duration := currenttime - DOB;
age_yrs := TRUNCATE (age_duration/ 1 YEAR);Explanation of results:
DOBstores the patient’s date of birth:1973-11-02T12:34:56Zage_durationcalculates the time difference fromDOBtocurrenttime, resulting in a full duration including years, months, weeks, days, hours, minutes, and seconds:51 years 9 months 1 week 5 days 4 hours 12 minutes 37.99999995320104 secondsage_yrsconverts that duration into a whole number of years usingTRUNCATE, giving51
Aggregation Operator
Aggregation operators in Arden Syntax work on lists and return a single value as the result. They are unary operators, meaning they take only one argument, the list you want to process.
The simplest examples are SUM and COUNT:
arden-syntax
logic:
list := (2, 3, 4);
sumVar := SUM list;
countVar := COUNT list;For instance, if you have the list (2, 3, 4), then SUM list will give 9, and COUNT list will give 3.
Other aggregation operators include
minimum,maximumfirst,lastany, which you can find in action hereaverage- standard deviation
stddevandvarianceamong others.
These operators aren’t limited to numbers, you can apply them to lists containing different data types, and the result will be appropriate for the type of data in the list. To get a full overview of all available aggregation operators and on what data types they are allowed to be executed on please refer to the official standard