Z-Script Built-in Functions
The Z-Script runtime provides the functions listed below across several categories. Availability can depend on the endpoint and runtime version; check the deployed runtime when you need a specific function.
1. Arithmetic & Math
| Form | Description |
|---|
(+ a b ...) | Addition of numbers |
(- a b ...) | Subtraction or unary negation |
(* a b ...) | Multiplication of numbers |
(/ a b ...) | Integer or floating division (fails on 0) |
(mod a b) | Modulo remainder |
(abs n) | Absolute value |
(min a b ...) | Smallest value in arguments |
(max a b ...) | Largest value in arguments |
(round n) | Round to nearest integer |
(floor n) | Floor to nearest integer |
(ceil n) | Ceiling to nearest integer |
2. Predicates & Logic
| Form | Description |
|---|
(= a b) | Deep equality check across numbers, strings, maps |
(!= a b) | Inequality check |
(< a b) / (<= a b) | Less than / less than or equal |
(> a b) / (>= a b) | Greater than / greater than or equal |
(not expr) | Logical negation |
(nil? expr) | Returns true if expression is nil |
(bool? expr) | Returns true if boolean |
(number? expr) | Returns true if numeric |
(string? expr) | Returns true if string |
(list? expr) | Returns true if list |
(map? expr) | Returns true if map object |
3. String Manipulation
| Form | Description |
|---|
(str a b ...) | Concatenate arguments into a single string |
(lower s) | Convert string to lowercase |
(upper s) | Convert string to uppercase |
(trim s) | Trim leading and trailing whitespace |
(split s sep) | Split string s by delimiter sep into a list |
(join list sep) | Join elements of list with separator sep |
(replace s old new) | Replace occurrences of old with new |
(contains? s substr) | Check if string contains substring |
(starts-with? s prefix) | Check if string begins with prefix |
(ends-with? s suffix) | Check if string ends with suffix |
(substr s start end) | Extract substring by byte/char range |
4. Collections & Lists
| Form | Description |
|---|
(len coll) | Length of list, string, or map |
(list a b ...) | Construct a new list |
(first coll) | First element of list |
(rest coll) | Remaining elements after the first |
(last coll) | Final element of list |
(nth coll idx) | Element at index idx (0-indexed) |
(cons elem list) | Prepend element to list |
(append list elem) | Append element to list |
(reverse list) | Reverse list order |
(sort list) | Ascending sort of numbers or strings |
(distinct list) | Remove duplicate elements |
(take n list) | First n elements |
(drop n list) | Elements after dropping first n |
(range start end) | Generate list of integers from start to end - 1 |
(map fn list) | Apply fn over each element |
(filter pred list) | Filter elements satisfying pred |
(reduce fn init list) | Fold list into single accumulated value |
5. Map Operations
| Form | Description |
|---|
(get map key) | Retrieve value by keyword or string key |
(get-in map [k1 k2]) | Retrieve value along nested path |
(assoc map k v) | Return new map with k set to v |
(dissoc map k) | Return new map with k removed |
(keys map) | Return list of keys in map |
(vals map) | Return list of values in map |
(has? map k) | Check if key exists in map |
(merge m1 m2) | Merge map m2 into m1 |
(select-keys map [keys]) | Return map containing only selected keys |