Giter Site home page Giter Site logo

darkart's Introduction

Darkart: Chez Scheme's Forign Library Interface

A binary interface let Chez Scheme use Python, Lua, Ruby etc's library

This project is inspired by the Julia language. The FFI interface provided by Chez is used to embed the interpreter or JIT compiler of other languages into the Scheme program (CPython, Luajit etc) or to link the compiled object code with the C binary interface. (OCaml, Golang etc).

This library can be ported to other Scheme implementations, with r6rs-pffi.

Priority: Python ✅ > Julia > Javascript > OCaml > lua ✅

Ecosystem: NumPySciPy 🚧 SymPy 🚧 MatplotlibPandas 🚧

Manual

https://github.com/guenchi/Darkart/blob/master/manual/python.md

Exemple

(define np (py-import 'numpy))

(define ndarray (py-get np 'ndarray))
(define pi (py-get np 'pi))
(define np-array (py-get np 'array))
(define np-sin (py-get np 'sin))
(define np-tolist (py-get ndarray 'tolist))

(define get-sin
    (lambda (lst)
        (plist->list
            (py-call np-tolist
                (py-call np-sin
                    (py-div
                        (py-mul pi 
                            (py-call np-array
                                (list->plist lst)))
                        (int 180)))))))

(get-sin '(1 2 3 4 5 6 7 8))

=>
(0.01745240643728351 0.03489949670250097 0.05233595624294383 0.0697564737441253 
0.08715574274765817 0.10452846326765346 0.12186934340514748 0.13917310096006544)

The ecosystem which base on Darkart:

https://github.com/guenchi/NumPy

https://github.com/guenchi/SciPy

https://github.com/guenchi/SymPy

https://github.com/guenchi/Matplotlib

https://github.com/guenchi/Pandas

(which is more python library binding exemples)

Sources:

https://github.com/JuliaPy/PyCall.jl/blob/master/src/PyCall.jl

https://docs.python.org/3.7/c-api/index.html

https://docs.python.org/2.5/ext/callingPython.html

http://www.linux-nantes.org/~fmonnier/OCaml/ocaml-wrapping-c.html

http://caml.inria.fr/pub/docs/manual-ocaml-4.00/manual033.html#htoc281

Deprecated attempt:

https://github.com/guenchi/Py-call

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.