diff --git a/README.md b/README.md index 0e926ca..ad52537 100644 --- a/README.md +++ b/README.md @@ -60,6 +60,9 @@ Available Operators: - lt: `<`: less than - load: `load`: load a key from the provided input `(load ".container.app_id")` - has-key: `has-key`: check if a key is in the input: `(has-key ".container.app_id")` +- let: `let`: assign a local variable: `(let x 10)` +- setq: `setq`: assign a global variable: `(setq x 11)` +- defun: `defun`: user-defined functions: `((defun greet (a) (write (+ "Hello " a "!"))) (greet "Alice"))` For example: `(> (load ".container.geometry.width") 300)` would match the first window where the width is greater than 300. diff --git a/i3toolwait b/i3toolwait index 0fe258b..c91c152 100755 --- a/i3toolwait +++ b/i3toolwait @@ -80,7 +80,7 @@ class Environment: '<': lambda _, _l, a, b: a < b, '>=': lambda _, _l, a, b: a >= b, '<=': lambda _, _l, a, b: a <= b, - '+': lambda _, _l, *a: sum(a), + '+': lambda _, _l, *a: functools.reduce(lambda a, b: a + b, a), '-': lambda _, _l, a, b: a - b, '*': lambda _, _l, *a: functools.reduce(lambda a, b: a * b, a), '/': lambda _, _l, a, b: a // b,