Coder Social home page Coder Social logo

clingo-rs's Introduction

clingo-rs

Build Status Latest Version Rust Documentation

Rust bindings to the clingo library. Clingo version 5.4.0.

Requirements

  • a c++14 conforming compiler
    • at least gcc version 4.9
    • clang version 3.1 (using either libstdc++ provided by gcc 4.9 or libc++)

Examples

cargo run --example=ast 0
cargo run --example=backend 0
cargo run --example=configuration
cargo run --example=control 0
cargo run --example=model 0
cargo run --example=propagator 0
cargo run --example=solve-async 0
cargo run --example=statistics 0
cargo run --example=symbol 0
cargo run --example=symbolic-atoms 0
cargo run --example=theory-atoms 0
cargo run --example=inject-terms 0
cargo run --example=version

Using derive macro

The crate provides a derive macro to help easing the use of rust data types as facts.

In your Cargo.toml add:

[dependencies]
clingo = { version = "0.6", features = ["derive"] }

In your source write:

use clingo::ToSymbol;
use clingo::ClingoError;
use clingo::FactBase;

#[derive(ToSymbol)]
struct MyPoint {
    x: i32,
    y: i32,
}

let p = MyPoint{ x:4, y:2 };
let fb = FactBase::new();
fb.insert(p);

The macro performs a conversion to snake case. This means the corresponing fact for MyPoint{x:4,y:2} is my_point(4,2).

Using dynamic_linking

The crate defines a Cargo feature that allows to use the clingo library via dynamic linking.

With dynamic linking enabled the clingo library is not build for static linking but it is assumed that a clingo dynamic library is installed on the system.

The recommended way to use the optional dynamic linking support is as follows.

[dependencies]
clingo = { version = "0.6.0", features = ["derive", "dynamic_linking"] }

Contribution

How to make a contribution to clingo-rs?

Any contribution intentionally submitted for inclusion in the work by you, shall be licensed under the terms of the MIT license without any additional terms or conditions.

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.