[Dev] How to convert Term[] to Entry

[Dev] How to convert Term[] to Entry - Messages

#1 Posted: 8/16/2017 4:51:38 AM
Martin Kraska

Martin Kraska

1222 likes in 2150 posts.

Group: Moderator

Hi, how can I convert a terms list to an entry structure? The core doc says there is a function SMath.Manager.TryFixStructure, which unfortunately doesn't seem to be available in 0.98.6398.

I also failed to find a function to convert expression strings to Entry.

Thanky you for any hint.
Martin Kraska Pre-configured portable distribution of SMath Studio: https://en.smath.info/wiki/SMath%20with%20Plugins.ashx
#2 Posted: 8/16/2017 5:21:07 AM
Davide Carpi

Davide Carpi

1416 likes in 2873 posts.

Group: Moderator

You can use the static method Entry.Create(IEnumerable value)

Entry myEntry = Entry.Crate(myTermsArray);
If you like my plugins please consider to support the program buying a license; for personal contributions to me: paypal.me/dcprojects
1 users liked this post
Martin Kraska 8/16/2017 7:14:00 AM
#3 Posted: 8/16/2017 7:26:33 AM
Martin Kraska

Martin Kraska

1222 likes in 2150 posts.

Group: Moderator

Thanks, Davide,

Seems that I asked the wrong question, I misunderstood an VS error message. It was about the result type, not of the argument type of Decision.NumericCalculation. I need to see how to handle TNumber objects.

BTW, if I want to move towards Entry instead of Term[] in the function arguments, do I need to do that everywhere at once or can I do that that step by step without breaking the whole plugin?

Martin
Martin Kraska Pre-configured portable distribution of SMath Studio: https://en.smath.info/wiki/SMath%20with%20Plugins.ashx
#4 Posted: 8/16/2017 3:06:36 PM
Davide Carpi

Davide Carpi

1416 likes in 2873 posts.

Group: Moderator

Wrote

Seems that I asked the wrong question, I misunderstood an VS error message. It was about the result type, not of the argument type of Decision.NumericCalculation. I need to see how to handle TNumber objects.


Numeric library makes really easy to handle TNumbers... some examples here (see f.e. fft2) and here (logic starts from line 360) (I'll look if I can post something compact and complete later tonight)

Wrote

BTW, if I want to move towards Entry instead of Term[] in the function arguments, do I need to do that everywhere at once or can I do that that step by step without breaking the whole plugin?


Absolutely, you can start implementing the IPluginLowLevelEvaluationFast instead of the IPluginLowLevelEvaluation, and convert Entry to Terms[] from where you don't are yet arrived in refactoring.
If you like my plugins please consider to support the program buying a license; for personal contributions to me: paypal.me/dcprojects
  • New Posts New Posts
  • No New Posts No New Posts