@linonetwo I will be doing something similar myself soon to sum/count the work time in a day, with a day planer.
set execution priority (like brackets in JS)
This is not only JS it is all of mathematics and no filters do not do this. It is to do with the nature of filters, they are almost by definition defined as a series of input/outputs with the filter determining what makes it through.
- Have a look at other command line filters to see what I mean, or even in synthesizer’s.
In a way the mathematics operators have being “shoe horned” into filters, a good thing to because we need them,
- however as a result we end up with maths we can’t use traditional orders of precedence with.
If you look for Evans formulae plugin, the calc plugin and other mathematics plugins there are solutions that allow that kind of calculation.
However if you don’t need to do a lot of maths and want to achieve something it is a simple matter of thinking outside a single filter. I try and point this out quite often, people want to overload the filter, when all they need is a $let widget or nested $list widgets.
- This will make the calculations look more like we see in traditional programing languages and places the logic in clear and readable steps.
I will come back and illustrate this if requested, but for now I will leave it to you (the reader) to think through the consequences of my above assertions.
Two notes
- The let widget allows one value to be set to be referenced later in the same let statement (thus is an order of precedent model)
- Nested list widgets allow every nested layer to use its own variable name, count items with a counter variable, and provide access to the variables from every nested list.
- TiddlyWiki 5.3.0 and its functions will allow custom filters to be used more practically than with the subfilter operator and allow custom operators. Arguably we can then “shoe horn” more maths into the one filter, but do we have to?