Boost logo

Boost :

Subject: Re: [boost] New Feature, MathString.
From: Rob Stewart (robertstewart_at_[hidden])
Date: 2014-12-13 05:32:37


On December 13, 2014 3:37:46 AM EST, "Jakub trzciński" <thejakubx_at_[hidden]> wrote:
>Hi. My name is Jacob and i am new here.

Welcome

>i have idea for new feature in
>boost. Actually i write a little library whitch name MathString. As you
>see
>by name the library will be calcule Row's from string. But it's not
>all. I
>was write a interface which add own Mathematical functions for row and
>variables. If you accept my idea i will send whole code.

I'm confused by your mention of "row". I see no array manipulation.

>Code for example
>
>MathString test("sqrt(x,2)");
>test.LinkFunction(&sqrt,"sqrt");
>test.pushVariable("x",4);
>cout<<test.getResluts();
>
>This code will be return 2 (as you know root with level 2 of 4 equals
>2)

Your example is confusing. sqrt() tasks a single argument, so I'd have expected the following:

MathString test("sqrt(x)");
test.LinkFunction(&sqrt,"sqrt");
test.pushVariable("x",4);
std::string result(test.getResult());
assert("2" == result);

What's unclear is the range of expressions supported and the kinds of function objects that can be bound to the expressions.

String to string has limited application. It could be used for an interactive shell, for example. I wonder if you compute an AST from the text and how much of it you expose. For example, an application that must parse mathematical expressions, from a configuration file, to use as part of its operation, would need to store objects to which values can be applied and from which results can be extracted. In that case, extracting the results in numeric, rather than string, form would be desirable.

___
Rob

(Sent from my portable computation engine)


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk