#wolfram-language #wolfram #wolfram-engine #expression #mathematica #link

wolfram-expr

Efficient and ergonomic representation of Wolfram expressions in Rust

5 releases

0.1.4 Feb 3, 2023
0.1.3 Dec 6, 2022
0.1.2 Jul 26, 2022
0.1.1 Feb 19, 2022
0.1.0 Feb 8, 2022

#750 in Encoding

Download history 41/week @ 2024-07-20 53/week @ 2024-07-27 31/week @ 2024-08-03 22/week @ 2024-08-10 17/week @ 2024-08-17 34/week @ 2024-08-24 37/week @ 2024-08-31 34/week @ 2024-09-07 34/week @ 2024-09-14 54/week @ 2024-09-21 56/week @ 2024-09-28 25/week @ 2024-10-05 47/week @ 2024-10-12 49/week @ 2024-10-19 46/week @ 2024-10-26 41/week @ 2024-11-02

185 downloads per month
Used in 8 crates (5 directly)

MIT/Apache

48KB
740 lines

wolfram-expr

Crates.io License Documentation

API Documentation | Changelog | Contributing

Efficient and ergonomic representation of Wolfram expressions in Rust.

Examples

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.

License

Licensed under either of

at your option.

Contribution

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.

Dependencies

~245KB