We are writing to let you know of a recent spin-off from our Scheme
implementation work: we now have a version implemented in Python. This is a
full Scheme with proper tail-call recursion handling written in Python.

We also added some interesting Python-Scheme interactions:

* Scheme can use Python functions and libraries
* You can define Scheme functions for use in Python
* Python's list class serves the role for Scheme's vector class

Some sample uses:

You can just use calicoscheme.py as a script in Python, IronPython, or
Jython:

$ python calicoscheme.py
Calico Scheme, version 3.0.0
----------------------------
Use (exit) to exit
==> (+ 1 1)
2

This environment has access to Python's built-ins through
calicoscheme.ENVIRONMENT:

==> (sum '(1 2 3))

sum is found in the Python environment.

You can also import and use Python libraries directly:

==> (using "math" "numpy")
(math numpy)
==> (math.sin 3.14)
0.0015926529164868282
==> (numpy.array 10)
array(100)
==> (exit) # or control+d

You can also use calicoscheme inside Python:

$ python
>>> import calicoscheme
>>> calicoscheme.ENVIRONMENT = globals()    # set the environment to the
locals here
>>> calicoscheme.start_rm()
==> (+ 1 1)
2
==> (define! f (lambda (n) (+ n 1)))     ### define! puts it in the
external env
==> (exit)
goodbye

And back in Python you can call the define! function using Scheme's
infrastructure:

>>> f(100)
101

You can also call into Scheme like so:

>>> calicoscheme.execute_string_rm("(define x 23)")
<void>
>>> calicoscheme.execute_string_rm("x")
23

To download and get more information, please see:

http://calicoproject.org/Calico_Scheme
-- 
https://mail.python.org/mailman/listinfo/python-announce-list

        Support the Python Software Foundation:
        http://www.python.org/psf/donations/

Reply via email to