diff options
Diffstat (limited to 'template.tlv')
-rw-r--r-- | template.tlv | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/template.tlv b/template.tlv index 49d35ed..c82d274 100644 --- a/template.tlv +++ b/template.tlv @@ -249,6 +249,45 @@ > return result >end - __teliva_timestamp: original + union: + >function union(a, b) + > for k, v in pairs(b) do + > a[k] = v + > end + > return a + >end +- __teliva_timestamp: original + subtract: + >-- set subtraction + >function subtract(a, b) + > for k, v in pairs(b) do + > a[k] = nil + > end + > return a + >end +- __teliva_timestamp: original + all: + >-- universal quantifier on sets + >function all(s, f) + > for k, v in pairs(s) do + > if not f(k, v) then + > return false + > end + > end + > return true + >end +- __teliva_timestamp: original + to_array: + >-- turn a set into an array + >-- drops values + >function to_array(h) + > local result = {} + > for k, _ in pairs(h) do + > table.insert(result, k) + > end + > return result + >end +- __teliva_timestamp: original append: >-- concatenate list 'elems' into 'l', modifying 'l' in the process >function append(l, elems) @@ -257,6 +296,14 @@ > end >end - __teliva_timestamp: original + prepend: + >-- concatenate list 'elems' into the start of 'l', modifying 'l' in the process + >function prepend(l, elems) + > for i=1,#elems do + > table.insert(l, i, elems[i]) + > end + >end +- __teliva_timestamp: original all_but: >function all_but(x, idx) > if type(x) == 'table' then |