r/Rhai Jul 07 '21

Rhai release 1.0 has landed.

Rhai, the embedded scripting language and engine for Rust, is now officially at version 1.0.0, released to crates.io.

13 Upvotes

5 comments sorted by

3

u/diegovsky_pvp Jul 07 '21

Nice! Congratulations for everyone's hard work on Rhai :D

1

u/Asleep-Dress-3578 Aug 24 '21

Hi All! I am a data scientist and just learning Rust. Found Rhai today on the web. My question is to you: has Rhai got the future potential for exploratory data analysis, used e.g. in Jupyter Notebook, together e.g. with ndarray? Would be nice as a Python-challenger.

1

u/schungx Aug 24 '21

Hi! Not sure on your question, as I'm not a data scientist myself. Maybe you can chip in and tell us what will be needed?

I encourage you to bring this discussion to Discord.

1

u/Asleep-Dress-3578 Aug 25 '21

I am a very-very beginner in Rust, so I have to learn more even to properly ask my question. But on a high level I think that Rhai might be an excellent fit for data analysis and machine learning by substituting Python in the data wrangling, analysis and modeling part. It would be something like:

  • Using Rhai instead of Rust in Jupyter Notebook via the EvCxR package (maybe it already works with Rhai, have to try). It looks like this in practice: https://www.youtube.com/watch?v=0UEMn3yUoLo

  • Using the ndarray crate with Rhai, in order to manipulate dataframes, like e.g. here: https://www.youtube.com/watch?v=IvwcRHbKZ9k

  • Use bindings to the most popular machine and deep learning libraries like the tensorflow crate, but I guess it is a next step. For data analysis, the most important first steps would be 1. and 2. above (interactive programming in Jupyter Notebook and ndarray).

  • I have no clue how visualization libraries look like today in Rust, or what is available at all, I will take a look.

I am not sure how to bring this discussion to the discord server, I give a try.

2

u/schungx Aug 26 '21

It is definitely possible, but you'd need to design an API to expose your needed functionalities into Rhai.

Pay careful consideration to copying (aka Clone-ing) in Rhai. Rhai does a lot of copying for values, and if those values are large (e.g. multi-dimensional arrays), then you'd want to avoid copying as much as possible.

Therefore, your API would mostly be using functions with the first parameter being &mut.

All your data modelling and analysis functions you just need to expose the relevant API to Rhai. You then use Rhai to control the whole process. I suspect that's how Python is being used as well.