[tw] Re: [TW5] rpn – Basic Math in Reverse Polish Notation (Prerelease)

2017-07-09 Thread Thomas Elmiger
Hi Josiah

1) You can pull together three operations like this: 

<$macrocall $name="rpn" a=<> b=<> operation="%"/>

or like this:

\define a() <>
\define b() <>

<$macrocall $name="rpn" a=<> b=<> operation="+"/>

If you need more you will have to wikify intermediate results.

2) Not really in the sense of true RPN where you could write "100 10 5 1 + 
* /" but I don’t find that very readabel/understandable so I did not use 
stacks to store operands and operators in. But as demonstrated in 1 it is 
possible with some limits. 

At the moment you can not use macros containing macros or lists as 
parameters. – Maybe I try to add this later or someone can give me a hint … 

All the best,
Thomas


Am Samstag, 8. Juli 2017 22:46:43 UTC+2 schrieb @TiddlyTweeter:
>
> i looked at your gizmo. i'm wondering 
>
> (1) if you can take the result of one calculation and feed it into another?
>
> (2) whether it allows more than one mathematical transformation at a time 
> (like it divides then multiplies then adds)?
>
> Just asking
> Josiah
>
> On Saturday, 8 July 2017 22:37:54 UTC+2, Thomas Elmiger wrote:
>>
>> Hi Saq
>>
>> You were right, that was easy and will be useful. rpn can now do % 
>> calculation as well as round upwards (Math.ceil) and downwards (Math.floor)
>>
>> https://tid.li/tw5/plugins.html#rpn%20%E2%80%93%20Basic%20Math%20in%20Reverse%20Polish%20Notation
>>
>> Have fun!
>> Thomas
>>
>> Am Sonntag, 2. Juli 2017 21:20:48 UTC+2 schrieb Saq Imtiaz:
>>>
>>> This is neat. The lack of any kind of ability to do basic arithmetic is 
>>> the biggest hindrance I've had so far in TW5. I rolled my own solution but 
>>> it is not without its own shortcomings.
>>>
>>> You can probably add support for % (modulus) without too much trouble. 
>>> Will give this a go next time I have the time to fiddle with my TW5 
>>> project. Bookmarked.
>>>
>>> Saq
>>>
>>

-- 
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/aa283d66-202d-4640-a993-f329ecf6e0b9%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[tw] Re: [TW5] rpn – Basic Math in Reverse Polish Notation (Prerelease)

2017-07-08 Thread @TiddlyTweeter
i looked at your gizmo. i'm wondering 

(1) if you can take the result of of one calculation and feed it into 
another?

(2) whether it allows more than one mathematical transformation at a time 
(like it divides then multiplies then adds)?

Just asking
Josiah

On Saturday, 8 July 2017 22:37:54 UTC+2, Thomas Elmiger wrote:
>
> Hi Saq
>
> You were right, that was easy and will be useful. rpn can now do % 
> calculation as well as round upwards (Math.ceil) and downwards (Math.floor)
>
> https://tid.li/tw5/plugins.html#rpn%20%E2%80%93%20Basic%20Math%20in%20Reverse%20Polish%20Notation
>
> Have fun!
> Thomas
>
> Am Sonntag, 2. Juli 2017 21:20:48 UTC+2 schrieb Saq Imtiaz:
>>
>> This is neat. The lack of any kind of ability to do basic arithmetic is 
>> the biggest hindrance I've had so far in TW5. I rolled my own solution but 
>> it is not without its own shortcomings.
>>
>> You can probably add support for % (modulus) without too much trouble. 
>> Will give this a go next time I have the time to fiddle with my TW5 
>> project. Bookmarked.
>>
>> Saq
>>
>

-- 
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/28775b91-ef7a-4d6b-8a6e-da1ea38c2939%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[tw] Re: [TW5] rpn – Basic Math in Reverse Polish Notation (Prerelease)

2017-07-08 Thread Saq Imtiaz
Great thank you. Will report back once I get a chance to play with it.

Saq

On Saturday, July 8, 2017 at 10:37:54 PM UTC+2, Thomas Elmiger wrote:
>
> Hi Saq
>
> You were right, that was easy and will be useful. rpn can now do % 
> calculation as well as round upwards (Math.ceil) and downwards (Math.floor)
>
> https://tid.li/tw5/plugins.html#rpn%20%E2%80%93%20Basic%20Math%20in%20Reverse%20Polish%20Notation
>
> Have fun!
> Thomas
>
> Am Sonntag, 2. Juli 2017 21:20:48 UTC+2 schrieb Saq Imtiaz:
>>
>> This is neat. The lack of any kind of ability to do basic arithmetic is 
>> the biggest hindrance I've had so far in TW5. I rolled my own solution but 
>> it is not without its own shortcomings.
>>
>> You can probably add support for % (modulus) without too much trouble. 
>> Will give this a go next time I have the time to fiddle with my TW5 
>> project. Bookmarked.
>>
>> Saq
>>
>

-- 
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/7fc991ec-ca2d-4561-95a7-9a1f439943cb%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[tw] Re: [TW5] rpn – Basic Math in Reverse Polish Notation (Prerelease)

2017-07-08 Thread Thomas Elmiger
Hi Saq

You were right, that was easy and will be useful. rpn can now do % 
calculation as well as round upwards (Math.ceil) and downwards (Math.floor)
https://tid.li/tw5/plugins.html#rpn%20%E2%80%93%20Basic%20Math%20in%20Reverse%20Polish%20Notation

Have fun!
Thomas

Am Sonntag, 2. Juli 2017 21:20:48 UTC+2 schrieb Saq Imtiaz:
>
> This is neat. The lack of any kind of ability to do basic arithmetic is 
> the biggest hindrance I've had so far in TW5. I rolled my own solution but 
> it is not without its own shortcomings.
>
> You can probably add support for % (modulus) without too much trouble. 
> Will give this a go next time I have the time to fiddle with my TW5 
> project. Bookmarked.
>
> Saq
>

-- 
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/8be47760-a692-4c0c-987e-63f23610a1f0%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[tw] Re: [TW5] rpn – Basic Math in Reverse Polish Notation (Prerelease)

2017-07-03 Thread Thomas Elmiger
Hi Josiah 

The short answer is: no. 

Maybe one of the prior existing alternatives is what you are looking for: 
http://mathcell.tiddlyspot.com/

Happy calculating!
Thomas 

-- 
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/83a86149-4832-4cd2-a6c7-e7ae59ff3887%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[tw] Re: [TW5] rpn – Basic Math in Reverse Polish Notation (Prerelease)

2017-07-03 Thread @TiddlyTweeter
Caro Thomas

Sounds great.

Can it add up a column of money numbers (negative and positive) in a table?

Josiah

-- 
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/bd02e604-f3d5-47b4-a691-af9b2eede22e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[tw] Re: [TW5] rpn – Basic Math in Reverse Polish Notation (Prerelease)

2017-07-02 Thread Saq Imtiaz
This is neat. The lack of any kind of ability to do basic arithmetic is the 
biggest hindrance I've had so far in TW5. I rolled my own solution but it 
is not without its own shortcomings.

You can probably add support for % (modulus) without too much trouble. Will 
give this a go next time I have the time to fiddle with my TW5 project. 
Bookmarked.

Saq

On Saturday, July 1, 2017 at 11:16:55 PM UTC+2, Thomas Elmiger wrote:
>
> Hi again!
>
> I. DID. IT. 
>
> After the most serious grinding of my most powerful gray cells alongside 
> the less powerful ones I can announce the *public beta of the universal 
> elegant lightweight calculation macro rpn *which offers (nearly) 
> everything a power user like legendary Mat with the hat <:-) could desire.
>
> * decimals that can be forced to show trailing zeros
> * integrated wikification of operands (!!!)
>
> To accomplish the second, I studied the great, long and complicated lesson 
> by Andreas Hahn here:
>
> https://groups.google.com/forum/?hl=de#!searchin/tiddlywikidev/parse$20a$20value$20using$20javascript%7Csort:relevance/tiddlywikidev/S5WuvbEPvvQ/Q__AI90O1o8J
>
> as well as the internals of the ingenious wikify widget on tiddlywiki.com 
> .
>
> The result can be tested on the address mentioned before: 
> https://tid.li/tw5/plugins.html#rpn%20%E2%80%93%20Basic%20Math%20in%20Reverse%20Polish%20Notation
>
> So get a fresh copy and enjoy calculating. *As always: make a backup 
> first,* use at your own risk. Feedback highly appreciated.
>
> Cheers, Thomas
>

-- 
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/4de655b6-349e-4be9-8c76-726ab24a141e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[tw] Re: [TW5] rpn – Basic Math in Reverse Polish Notation (Prerelease)

2017-07-01 Thread Thomas Elmiger
Hi again!

I. DID. IT. 

After the most serious grinding of my most powerful gray cells alongside 
the less powerful ones I can announce the *public beta of the universal 
elegant lightweight calculation macro rpn *which offers (nearly) everything 
a power user like legendary Mat with the hat <:-) could desire.

* decimals that can be forced to show trailing zeros
* integrated wikification of operands (!!!)

To accomplish the second, I studied the great, long and complicated lesson 
by Andreas Hahn here:
https://groups.google.com/forum/?hl=de#!searchin/tiddlywikidev/parse$20a$20value$20using$20javascript%7Csort:relevance/tiddlywikidev/S5WuvbEPvvQ/Q__AI90O1o8J

as well as the internals of the ingenious wikify widget on tiddlywiki.com 
.

The result can be tested on the address mentioned before: 
https://tid.li/tw5/plugins.html#rpn%20%E2%80%93%20Basic%20Math%20in%20Reverse%20Polish%20Notation

So get a fresh copy and enjoy calculating. *As always: make a backup first,* 
use at your own risk. Feedback highly appreciated.

Cheers, Thomas

-- 
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/420e0193-1f2a-4861-b8ed-8878df2dcf68%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[tw] Re: [TW5] rpn – Basic Math in Reverse Polish Notation (Prerelease)

2017-07-01 Thread Mat
Thanks for reply! I'll look closer at your answer, but for now just to 
clarify my point about if it is possible to avoid having to use wikify (e.g 
by having it "built in" instead?). 

Compare this...

\define tot_words()
<$wikfiy name=wpt text=<> >
<$wikfiy name=not text=<> >
<$macrocall $name="rpn" a=<> b=<> operation="*" />


\end

Total words in my wikis:
<$wikify name=tw text=<>>
<$macrocall $name="rpn" a=<> b="10" operation="*"/>


...compared to...
 
\define tot_words() <$macrocall $name="rpn" a=<> b=<<
nr_of_tids>> operation="*" />

Total words in my wikis:
<$macrocall $name="rpn" a=<> b="10" operation="*"/>


Forcing to use surrounding stuff quickly adds up when there are a few steps 
in the calculations.

I have no idea how you've made rpn but maybe it's possible to make a and b 
pass a wikify filter automatially?

<:-)

-- 
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/39fe2a8c-73cf-4391-884e-58571bba53e8%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[tw] Re: [TW5] rpn – Basic Math in Reverse Polish Notation (Prerelease)

2017-07-01 Thread Thomas Elmiger
Hi Mat

Thanks for the great feedback!!! I guess I overlooked calc on Tobias’ pages 
either because I ran into math.js first and was repelled by it’s complexity 
… or I did not evaluate it further because it is specialised on working 
with field values which I do not need. (But I found out that rpn covers 
this also in a way I would prefer.) I have added it to my alternatives of 
course.

First of all: I like your hint to the term decimals! For me it suggests, 
that a fixed number of digits after the comma would be returned. rpn can’t 
do that (it would be nice to show the exactness of a result). But maybe it 
is just me?

Here are some differences and similarities I found: 

* calc has more functionality (until, beyond, by) – as all solutions by 
Tobias it is very sophisticated, mine is primitive ;–)
* calc unites operator and operand – rpn separates them (this makes my 
macro usage easier)
* calc does not round all numbers the same way – some are rounded up, 
others are floored (see example below)
* calc and rpn both do not return trailing zeros (as one could hope 
specifying parameters like decimals or dacs)
* both can handle values from fields: calc accepts field (and tiddler) 
names, in rpn you can use transclusions

You can copy this in a new tiddler in the calc wiki 
 to try yourself: 

<>

<>

<> – the 5 in 1.5 is rounded (up)

<> – the last 5 is floored

---

calc has 2444 characters, rpn.js has 1305

<>

that is a plus of 87 percent

I am not sure about your last question. For the first I use wikify a lot 
myself – are there any disadvantages I am not aware of?

Second: I guess you are not after this:
<$macrocall $name="rpn" a=<> b=<> operation="*"/>

rpn expects text as input and interpretes it as a number, wikify is a safe 
way to get text as output from other macros … 

Thanks again and have a nice weekend!

-- 
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/77699567-8637-44fa-8e8e-792578f47758%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[tw] Re: [TW5] rpn – Basic Math in Reverse Polish Notation (Prerelease)

2017-06-30 Thread Mat
Great stuff Thomas!!! I very much need this NOW for an ambitious TW project 
soon to be released.

In my project, I'm currently I'm using Tobias' calc macro 
, and I note this is missing from your 
"Alternatives" list. Any reflections on how yours compares to this?

He has an interesting cleveness in merging the operator with one of the 
operands, which saves a definition for the user. I.e his syntax is

<>
 or
 <$macrocall $name=calc value=5 operation="+2" />


I really like that yours allow concatenation! This should come in handy. 

("dacs"? ...I'll never remember that and I believe the standard term is 
decimals ;-) 


Yours looks promising in the sense of not making multi-step calculations 
overly cluttered - but is it possible to make the following work without 
the wikify widget? 

\define foo() <>

<$wikify name=f text=<>>
<$macrocall $name="rpn" a=<> b=<> operation="*"/>



Anyway, really cool Thomas!!!


<:-)

-- 
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/f983b90e-24ac-47a0-be1e-70bf7faaadfd%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.