GithubHelp home page GithubHelp logo

classicvalues / wolfram-expr-rs Goto Github PK

View Code? Open in Web Editor NEW

This project forked from wolframresearch/wolfram-expr-rs

0.0 1.0 0.0 126 KB

Representing Wolfram Language expressions in Rust.

License: Apache License 2.0

Rust 100.00%

wolfram-expr-rs's Introduction

wolfram-expr

Crates.io License Documentation

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()
    ),
}

Related Links

Related crates

  • 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.

wolfram-expr-rs's People

Contributors

connorgray avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.