Path: csiph.com!newsfeed.hal-mli.net!feeder3.hal-mli.net!newsfeed.hal-mli.net!feeder1.hal-mli.net!newsfeed.xs4all.nl!newsfeed2.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-announce-list@python.org Delivered-To: python-announce-list@mail.python.org X-Spam-Status: OK 0.002 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'python.': 0.02; 'python,': 0.02; 'subject:Python': 0.06; '(using': 0.07; 'puts': 0.07; 'see:': 0.07; '101': 0.09; 'exit': 0.09; 'python:': 0.09; 'python': 0.11; '###': 0.16; '(lambda': 0.16; 'to:addr:python- announce-list': 0.16; "python's": 0.19; 'written': 0.21; '>>>': 0.22; 'import': 0.22; '>>>': 0.24; 'environment': 0.24; 'script': 0.25; 'define': 0.26; 'handling': 0.26; 'function': 0.29; 'external': 0.29; 'message-id:@mail.gmail.com': 0.30; 'libraries': 0.31; 'work:': 0.31; 'class': 0.32; 'skip:c 30': 0.32; 'implemented': 0.33; 'role': 0.34; 'received:google.com': 0.35; 'version': 0.36; 'scheme': 0.36; 'url:org': 0.36; 'skip:- 20': 0.37; 'list': 0.37; 'skip:& 10': 0.38; 'recent': 0.39; 'environment.': 0.39; 'to:addr:python.org': 0.39; 'full': 0.61; 'information,': 0.61; 'back': 0.62; 'our': 0.64; 'sum': 0.64; 'more': 0.64; 'here': 0.66; 'sample': 0.67; '==>': 0.84; 'env': 0.84 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:date:message-id:subject:from:to:content-type; bh=kqVdQgOxsSPtk95NF0ZoZBwBnxE6HclooI1Z78GZHps=; b=Ib5b7Ek5udX05QQthQ+U/QLKTTmgx7CZBg3HyclxYPahknsGhYpmAUEHzMOteziTGl QLQpi6WQ33gDoNuot/+uC670zHRRqzRiFcI9hXxb9WmQGpTQfQHna5Z7tjgBs5AhGNrq lWB3G+31puGnTDWH8LyCFs6KASyDRcGo6s3Cq6iwPcECTXCsTG+W+hsY4tLBsgntNSsa DhtB73Wlfz5LsJF25HtgDw69OwGfCr7NQg3VuZRXOHH28fkYAtmVm94+IzoA5VkJ5ItE r+CXgyq9O6G+5ibHx9p2Uoo1rLK8jtryCuvcLniF6sxeHBwW+CBokHG1dxyHGzNqryZr 91Ag== MIME-Version: 1.0 X-Received: by 10.221.34.7 with SMTP id sq7mr34352619vcb.5.1397447554806; Sun, 13 Apr 2014 20:52:34 -0700 (PDT) Date: Sun, 13 Apr 2014 23:52:34 -0400 Subject: Calico Scheme in Python From: Doug Blank To: python-announce-list@python.org X-Mailman-Approved-At: Mon, 14 Apr 2014 11:28:53 +0200 Content-Type: text/plain; charset=ISO-8859-1 X-Content-Filtered-By: Mailman/MimeDel 2.1.15 X-BeenThere: python-announce-list@python.org X-Mailman-Version: 2.1.15 Precedence: list Reply-To: python-list@python.org List-Id: Announcement-only list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Approved: python-announce-list@python.org Newsgroups: comp.lang.python.announce Message-ID: Lines: 69 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1397467735 news.xs4all.nl 2964 [2001:888:2000:d::a6]:56403 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python.announce:1261 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)") >>> calicoscheme.execute_string_rm("x") 23 To download and get more information, please see: http://calicoproject.org/Calico_Scheme