eclisp 0.2.0

Bindings for Embeddable Common Lisp
use eclisp::{Lisp, LispError, sys};

unsafe extern "C" fn answer() -> sys::cl_object {
    unsafe { sys::eclisp_int_raw(42) }
}

fn main() -> Result<(), LispError> {
    let lisp = Lisp::new()?;

    lisp.enter(|ctx| {
        // `defun_native_0` sets the function callback to an `unsafe extern "C"` function that
        // operates on `sys::cl_object`. Context also provides a macro to automatically choose the
        // correct amount of arguments (<=8).
        ctx.defun_native_0("answer", answer)?;

        let result = ctx.eval("(answer)")?;
        println!("Result: {:?}", result);

        Ok::<(), LispError>(())
    })?;

    Ok(())
}