![]() ![]() Jupyter KernelĮxtensions to Jupyter are called "kernels," EVCXR offers a Jupyter kernel capable of allowing Rust to be used within a notebook. The additional dependency gamma (the graph library on which ChemCore is based) brings the Graph methods of Molecule into scope. $ evcxr > :dep chemcore = "0.2.1" > :dep gamma = "0.6.1" > extern crate chemcore > use chemcore::molecule::Molecule > use gamma::graph::Graph > let m = chemcore::daylight:: read(& "1ccccc1").unwrap() > m.degree(0) Once added, the dependency works as expected. For example, the following snippet adds ChemCore, a cheminformatics toolkit written in Rust. $ evcxr > let mut s = String::from( "Hello, ") > s.push_str( "World!") > sĮVCXR supports the inclusion of private and public crates through the :dep command. As a demonstration, consider a simple "Hello, World" program, written interactively. ![]() The EVCXR REPL can be installed with the following command: $ cargo install evcxr_repl ![]() Using EVCXR, both modes of interactive programming are now possible using Rust. The result can be stored, published, and replayed. Some expressions can evaluate to graphical output such as images and charts. Expression and output blocks are grouped into cells displayed within a Web browser. Examples include the Python interpreter and the JavaScript browser console. A history allows retrieval of previous entries. Expressions are entered and evaluated, one at a time, from a terminal. Two broad approaches to interactive programming can be found today: This article discusses interactive programming with Rust courtesy of the EVCXR crate. Rust is a newer compiled language for which interactive programming has recently emerged. Compiled languages such as Java and C++ can also be used interactively, but tooling tends to lag by many years. This capability is most often associated with dynamically evaluated languages such as JavaScript and Python. Interactive programming, in which expressions are entered and evaluated in real-time, can be a powerful tool for exploring a language and problem solving. Interactive Rust in a REPL and Jupyter Notebook with EVCXR ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |