Skip to content

Commit

Permalink
doc: add Python embedding subchapter
Browse files Browse the repository at this point in the history
Signed-off-by: noxdafox <noxdafox@gmail.com>
  • Loading branch information
noxdafox committed Dec 24, 2017
1 parent 2640306 commit fd9f6c9
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions doc/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,15 @@ CLIPS Python bindings

Python CFFI_ bindings for the 'C' Language Integrated Production System (CLIPS_) 6.30


Design principles
-----------------

The clipspy bindings aim to be a "pythonic" thin layer built on top of the CLIPS native C APIs. Most of the functions and the methods directly resolve to the CLIPS functions documented in the `Advanced Programming Guide`_.

Python standard paradigms are preferred such as property getters and setters, generators and magic methods.


Data types
----------

Expand Down Expand Up @@ -90,6 +92,23 @@ If the previous example is pretty straightforward, there are more subtle scenari
print(template)
Embedding Python
----------------

Through the `define_function` method, it is possible to embed Python code within the CLIPS environment.

The Python function will be accessible within CLIPS via its name as if it was defined via the `deffunction` construct.

.. code:: python
def function(arg, keyarg=0):
return arg + keyarg
env.define_function(function)
env.eval('(function 1 2)')
API documentation
-----------------

Expand Down

0 comments on commit fd9f6c9

Please sign in to comment.