Thanks Tony. 

I have googled a bit and found these alternatives to this same need:

http://mathcell.tiddlyspot.com/
http://rboue.tiddlyspot.com/#SocialCalc/introduction
http://evanbalster.com/tiddlywiki/formulas.html

These are quite awesome already. I really liked SocialCalc, and mathcell 
uses native eval which is not great.

I think math.js is great and is good enough to be taken as a standard for 
TW, for evaluating math expressions, however SocialCalc solution is great 
as it is.


El miércoles, 22 de agosto de 2018, 22:52:41 (UTC-6), TonyM escribió:
>
> Guille Rmo
>
> Thanks for sharing your work. Increments have being difficult in 
> TiddlyWiki, this works good as a button counter.
>
> You may be interested in the new range operator coming in V 5.1.18
>
> Regards
> Tony
>
> On Thursday, 23 August 2018 04:14:47 UTC+10, Guille Rmo wrote:
>>
>> I found math.js 
>> <https://groups.google.com/forum/#!topic/tiddlywiki/cPq72e4x1f8> plugin 
>> for tw a while ago. However I didn't managed to do what I wanted with it. I 
>> wanted to set a field value with a math expression. I remember I managed to 
>> do it with a macro and a $set variable, but I think that is not very clean. 
>> Instead, I thought that making an alternative action-setfield widget was 
>> the right thing to do. So I took @mklauber plugin and wrote the widget.
>>
>> See the following examples to get an Idea of what is possible with this:
>>
>> This button raises the field "test2" to the power of 2 each time it is 
>> clicked:
>>
>> <$button>
>> <$action-setfield-mathjs $tiddler=<<currentTiddler>> $field="test2" 
>> $eval="test2^2" />
>> Click to raise <b>{{!!test2}}</b> to the power of 2
>> </$button>
>>
>> You can also manipulate data tiddlers. In the following, the data tiddler 
>> [[ExampleData]] is updated with math operations:
>>
>> <$button>
>> <$action-setfield-mathjs $tiddler="ExampleData" $index="y" $eval="y+1" />
>> Click to increment y ( {{ExampleData##y}} )
>> </$button>
>>
>> <$button>
>> <$action-setfield-mathjs $tiddler="ExampleData" $index="x" $eval="x+1" />
>> Click to increment x ( {{ExampleData##x}} )
>> </$button>
>>
>>
>> The tiddler fields or the data tiddler indexes are set as the math.js 
>> scope, so you can use the names in the math.js expressions.
>>
>> The main motivation for this was having a simple increment button :) But 
>> it is quite powerful. Hope you can come up with great use cases for this.
>>
>> The demo is here: 
>> https://cdn.rawgit.com/Guitlle/tiddly-mathjs/build/tmp.html
>>
>>
>>

-- 
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 tiddlywiki+unsubscr...@googlegroups.com.
To post to this group, send email to tiddlywiki@googlegroups.com.
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/9d915a59-fa3c-4226-be4b-447fbfa29812%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to