Custom built-in functions
NatanFreeman opened this issue · 8 comments
I would like to define custom built in functions from Rust call-backs. This makes the functions more extendable as you have access to Rust's functionality like println!
along with other Rust math libraries. Is this currently possible? If not I think this should be considered. It allows fore greater extendibility without the need of another parser.
I've been thinking about implementing some way to have custom built-in functions. This sounds like a good way to do it. Would love to implement this at some point.
This would be something that would need to be implemented in the kalk
crate, right?
I am very new to all of this, but this seems somewhat straightforward, would I be allowed to try to implement this?
@Yusuto Correct, that would be done in kalk
. Feel free to give it a try! Function calls are evaluated in interpreter.rs#L330.
@PaddiM8 Okai, Thank you! I looked around a bit and this stuff seems to be significantly more complex that I first imagined. In hindsight it makes sense, since it's in essence somewhat of a tiny programming language ><
Am I correct in that kalk
as of now has pretty much no documentation? If so I could offer to write some rustdoc as I go about understanding everything, if that is desired!
@Yusuto Yeah it basically turned into a small languages, woops. You're right, it does lack documentation. That would be great!
Yep! I think it's actually quite interesting and sounds pretty powerful, it's sadly not Wolfram Alpha, but I have come to use kalker
as my day-to-day calculator to the point where I aliased it to just k
in my shell.
I have very little experience with that, but it seems like it could be turned into a good PWA? I'd very thrilled to have a proper calculator on my phone, not sure if that's just me but it seems like all the alternatives are just kind of- ugly. I mean they do their job but not really much more. And kalker
already works quite decently in a mobile browser, so ^^
I saw some project files for Android, I suppose a native app would be even better, you could maybe even have things such as a widget for quickly calculating or something, that sounds convenient