Jeremy,

Yet another new feature on the horizon that will add great utility to 
TiddlyWiki, Even better if it "uses the *really small and simple: by 
re-using all the existing filter operator infrastructure"* and I see that 
$set and triple curly braces 
{{{ filter }}}
that transcludes the result of the filter will be common ways of using the 
"math filters"

I personally love filters but this is only now that years of experience 
makes me very comfortable with them, 

I am concerned about new users who want to implement maths but have not yet 
fully grasped filter concepts, this includes variables, transclusions and 
references in maths filters. Could we try and make the documentation spell 
out how to achieve common uses? I would be happy to contribute here of 
course.

I am keen to ensure we document how to use maths in the following high 
level cases with variables, transclusions and references

   - Within wikiText
   - Within Filters (in this case interacting with title lists)
   - Within Widgets and HTML - Parameters and Attributes
   - Within macro definitions / macro body
   - Within a Macro call or for a "macro parameter"
   - and Concatenating values for use in maths formulae

Since this is new I am not yet in a position to test it, but will we be 
able to retrieve the maths results an use them in the above as easily as we 
can with Evans (= mushroom brackets =) ? Perhaps we can provide an easy 
method to allow "substitution" of a maths result such as $(mathresult)$ may 
imply.


Regards
Tony


On Friday, February 8, 2019 at 8:42:06 AM UTC+11, Jeremy Ruston wrote:
>
> Hi Mat
>
> Great, glad you like it! This is a new implementation that emerged from 
> discussions about a different issue on GitHub (see 
> https://github.com/Jermolene/TiddlyWiki5/pull/3572#issuecomment-460958193
> ).
>
> It is a bit different than Matt’s Calc plugin <
> https://github.com/mklauber/tiddly-calc> and Evan’s Formula plugin <
> https://github.com/EvanBalster/TiddlyWikiFormula>. It doesn’t use 
> conventional “postfix” maths notation (ie, the familiar stuff like (2+2)/3 
> etc.). Instead, it implements maths operations as filter operators that 
> work the same way as others except that they interpret their arguments as 
> numbers and numeric results are converted to strings.
>
> I went for this approach because it makes things really, really small and 
> simple: by re-using all the existing filter operator infrastructure we 
> avoid having to add or implement a new expression parser. On the other 
> hand, it means that it isn’t much use for formulae that have been entered 
> by users not familiar with TiddlyWiki’s filter syntax. We’ll still need 
> plugins like those above for those applications.
>
> I haven’t quite finished the documentation, but the list of new operators 
> is as follows - there are new string operators like split and join as well 
> as the maths operators:
>
> *negate* - negation
> *abs* - absolute value
> *ceil* - smallest integer greater than or equal to a given number
> *floor* - the largest integer less than or equal to a given number
> *round* - the value of a number rounded to the nearest integer
> *trunc* - the integer part of a number by removing any fractional digits
> *sign* - the sign of a number, indicating whether the number is positive, 
> negative or zero
> *add* - add an operand to every number in the input list
> *subtract* - subtract an operand from every number in the input list
> *multiply* - multiply every number in the input list by an operand
> *divide* - divide every number in the input list by an operand
> *remainder* - replace each item in the input list with the remainder when 
> dividing that number by an operand
> *max* - replace any number in the input list larger than the operand with 
> the operand
> *min* - replace any number in the input list smaller than the operand 
> with the operand
> *fixed* - formats a number using fixed-point notation with the number of 
> fractional digits after the decimal point given by the operand
> *precision* - returns a string representing the number to the precision 
> specified in the operand
> *exponential* - returns a string representing the Number object in 
> exponential notation with the number of digits after the decimal point 
> specified in the operand
> *sum* - replaces the input list with the sum of all the entries
> *product* - replaces the input list with the product of all the entries
> *maxall* - replaces the input list with the maximum value of all the 
> entries
> *minall* - replaces the input list with the minimum value of all the 
> entries
> *length* - replaces each item in the input list with its string length in 
> characters
> *uppercase* - replaces each item in the input with its uppercase 
> equivalent
> *lowercase* - replaces each item in the input with its lowercase 
> equivalent
> *trim* - trims each item in the input list
> *concat* - concatenates all of the items in the input list into a single 
> string
> *split* - splits each of the items in the input list by a given separator
> *join* - joins all of the items in the input list with a given separator
>
>
> As usual, any comments and thoughts welcome,
>
> Best wishes
>
> Jeremy
>
>
>
> On 7 Feb 2019, at 20:42, Mat <[email protected] <javascript:>> wrote:
>
> Hi guys! ...in spite of my absence I do 'peek by' occasionally and I just 
> noted that math operators are added to the prerelease 
> <https://tiddlywiki.com/prerelease/#Mathematics%20Operators>!
>
> I just want to thank whoever is behind this (Evan?), plus Jeremy for 
> including it in core! Basic math ops is one of those things that anyone 
> needs either sooner or later in a utility tool like TW, so: THANK YOU!
>
> Also, anyone curious about TW should hear about this right away so it 
> deserves a mention in HelloThere.
>
> IMO, "basic math" was the missing piece to fulfill the "minimum of a fully 
> *general* note-taking tool" - i.e: produce text, produce images, do 
> calculations.
>
> Wonderful!
>
> <:-)
>
> P.S sorry for my absence but it will continue for a while.
>
> -- 
> You received this message because you are subscribed to the Google Groups 
> "TiddlyWiki" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to [email protected] <javascript:>.
> To post to this group, send email to [email protected] 
> <javascript:>.
> Visit this group at https://groups.google.com/group/tiddlywiki.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/tiddlywiki/1eaad72c-4e80-4999-926c-13cf7ea16ba8%40googlegroups.com
>  
> <https://groups.google.com/d/msgid/tiddlywiki/1eaad72c-4e80-4999-926c-13cf7ea16ba8%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"TiddlyWiki" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/tiddlywiki.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywiki/1cefed6d-d923-48dd-8f15-c83c55565cc1%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to