Crates.io | wolfram-expr |
lib.rs | wolfram-expr |
version | 0.1.4 |
source | src |
created_at | 2022-02-08 23:35:00.506911 |
updated_at | 2023-02-03 21:08:33.361632 |
description | Efficient and ergonomic representation of Wolfram expressions in Rust |
homepage | |
repository | https://github.com/WolframResearch/wolfram-expr-rs |
max_upload_size | |
id | 529372 |
size | 64,954 |
Efficient and ergonomic representation of Wolfram expressions in Rust.
Construct the expression {1, 2, 3}
:
use wolfram_expr::{Expr, Symbol};
let expr = Expr::normal(Symbol::new("System`List"), vec![
Expr::from(1),
Expr::from(2),
Expr::from(3)
]);
Pattern match over different expression variants:
use wolfram_expr::{Expr, ExprKind};
let expr = Expr::from("some arbitrary expression");
match expr.kind() {
ExprKind::Integer(1) => println!("got 1"),
ExprKind::Integer(n) => println!("got {}", n),
ExprKind::Real(_) => println!("got a real number"),
ExprKind::String(s) => println!("got string: {}", s),
ExprKind::Symbol(sym) => println!("got symbol named {}", sym.symbol_name()),
ExprKind::Normal(e) => println!(
"got expr with head {} and length {}",
e.head(),
e.elements().len()
),
}
wolfram-library-link
— author libraries that can be
dynamically loaded by the Wolfram Language.
wstp
— bindings to the Wolfram Symbolic Transport Protocol, used for passing
arbitrary Wolfram expressions between programs.
wolfram-app-discovery
— utility for locating local
installations of Wolfram applications and the Wolfram Language.
Licensed under either of
at your option.
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.
See CONTRIBUTING.md for more information.