How create a operator tree?

Namespace rswhite4 at googlemail.com
Thu Aug 16 16:41:24 PDT 2012


On Thursday, 16 August 2012 at 22:05:44 UTC, Namespace wrote:
> Is there a simple function to create an operator tree of a term?
>
> For example:
> Term: 4 + 5 * 8
> Tree:
> [*, 5, 8, +, 4]
>
> Or:
> Term: 2 * 2 + 2:
> Tree: [*, 2, 2, +, 2]

That seems to work: http://dpaste.dzfl.pl/95dccfa4
But it's more of a quick and dirty solution of me. Does anyone 
know, how can i do it more elegant?

P.S.: Exists such "Diff" function as i used there in the standard 
library? I think something like that would be very useful.


More information about the Digitalmars-d-learn mailing list