[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: variable command interpretter
From: |
Evan Prodromou |
Subject: |
Re: variable command interpretter |
Date: |
19 Jun 2001 08:57:47 -0700 |
User-agent: |
Gnus/5.09 (Gnus v5.9.0) Emacs/21.0.103 |
>>>>> "PE" == Paul Emsley <address@hidden> writes:
PE> Do I take it then that it can't be done today - but I
PE> should relax and let them choose python in the knowledge that
PE> sometime in the future I will be able drop python and link
PE> with guile and python-> guile?
Two things, really quickly. First, if you really want to have custom
syntax for your particular system, you should use Guile. Guile, like
most Schemes, has a language extension mechanism, so you can actually
make up new language primitives that will be more fit to your system.
For example, you might be able to define a syntax that does something
like:
(define-molecule water H-O-H) ; Does all the hard stuff
(molecular-weight water) => 18 ; or whatever... uh.
(covalent-bonds water) => 2 ; again
(charge water) => 0
(define-molecule stuff H=C-C=O-P) ; Over my head here B-)
(mix-with stuff H+Cl-)
(add NaCl H20) => (NaOH HCl)
In this example, I used a format that chemists would actually
understand more easily (I think -- not a chemist myself, obviously --
roughly high-school level chem there) to define the molecule. Because
Scheme lets you extend the language, the "define-molecule" macro I
wrote there becomes a new part of your "chemistry language."
Second, why not start with Guile, and then let them use a
Python-language compatibility module in the future? B-) Seriously,
Python programmers tend to pick up lisp-like languages pretty easily.
~ESP
--
Evan Prodromou
address@hidden