https://github.com/wolframresearch/wolfram-expr-rs
Representing Wolfram Language expressions in Rust.
https://github.com/wolframresearch/wolfram-expr-rs
rust rust-crate wolfram-language
Last synced: 9 months ago
JSON representation
Representing Wolfram Language expressions in Rust.
- Host: GitHub
- URL: https://github.com/wolframresearch/wolfram-expr-rs
- Owner: WolframResearch
- License: apache-2.0
- Created: 2022-01-04T19:17:35.000Z (about 4 years ago)
- Default Branch: master
- Last Pushed: 2023-12-10T01:11:15.000Z (about 2 years ago)
- Last Synced: 2025-04-10T21:45:39.077Z (9 months ago)
- Topics: rust, rust-crate, wolfram-language
- Language: Rust
- Homepage:
- Size: 146 KB
- Stars: 17
- Watchers: 6
- Forks: 5
- Open Issues: 7
-
Metadata Files:
- Readme: README.md
- Contributing: docs/CONTRIBUTING.md
- License: LICENSE-APACHE
Awesome Lists containing this project
README
# wolfram-expr
[](https://crates.io/crates/wolfram-expr)

[](https://docs.rs/wolfram-expr)
API Documentation
|
Changelog
|
Contributing
Efficient and ergonomic representation of Wolfram expressions in Rust.
## Examples
Construct the expression `{1, 2, 3}`:
```rust
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:
```rust
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()
),
}
```
## Related Links
#### Related crates
* [`wolfram-library-link`][wolfram-library-link] — author libraries that can be
dynamically loaded by the Wolfram Language.
* [`wstp`][wstp] — bindings to the Wolfram Symbolic Transport Protocol, used for passing
arbitrary Wolfram expressions between programs.
* [`wolfram-app-discovery`][wolfram-app-discovery] — utility for locating local
installations of Wolfram applications and the Wolfram Language.
[wstp]: https://github.com/WolframResearch/wstp-rs
[wolfram-app-discovery]: https://crates.io/crates/wolfram-app-discovery
[wolfram-library-link]: https://github.com/WolframResearch/wolfram-library-link-rs
## License
Licensed under either of
* Apache License, Version 2.0
([LICENSE-APACHE](LICENSE-APACHE) or )
* MIT license
([LICENSE-MIT](LICENSE-MIT) or )
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](./docs/CONTRIBUTING.md) for more information.