Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Providing a REPL / single input single output library functionality ? #42

Open
lollita opened this issue Mar 24, 2022 · 2 comments
Open

Comments

@lollita
Copy link

lollita commented Mar 24, 2022

Do it is possible to have a isolated function or library that parse the line and return the result?
also in wasm.
f.e.
parse("calc = 5k + 4k");
that return
9 kg

@bbodi
Copy link
Owner

bbodi commented Mar 25, 2022

Hi,

Yes, as you can see, notecalc-lib is a separate library, so you can include it in your app and feed any string into it. You can find some examples in the benchmark folder (benchmarks were implemented as a binary crate using notecalc as a library, the same way as your wished feature).

Though, the ergonomics are not the best, since the notecalc lib handles text editor and other functionalities as well, also one of the strength of notecalc is being a multilne calculator, referencing other lines in your formula, or calculating averages or sums of many lines.

@bbodi bbodi changed the title libcalc Providing a REPL / single input single output library functionality ? Mar 25, 2022
@lollita
Copy link
Author

lollita commented Mar 25, 2022

Of course, I saw it.
But inside there are very things and it is difficult to isolate you only the routine that seemed the calculations and generally use it in another context.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants