david casal D.Casal@uea.ac.uk wrote:
Anyone know of a painless way to do LISP to SCHEME translation? Going through an old ai textbook (95...) where all code is LISP. I realise I could do it manually, but since I know there's at least one heavy schemer in ALUG (won't name mark, I mean names...), I thought there might be an emacs trick or something like that. Bear in mind newbie understanding of macros and issues involved, etc.
There are lookup tables of equivalent functions and you can get a long way by doing simple search and replace, but there are a few fundamental differences which will haunt you. For example:
1. Lisp has multiple namespaces for functions, variables, etc; but to Scheme, a function is just a variable which can be applied to things.
2. Lisp has a particular OO system as standard; Scheme allows you to mix and match styles inside the modules as needed.
3. Scheme has finally eliminated iteration; but Lisp programmers seem to rely (too?) heavily on DO.
3. Scheme's standard macros are what is known as "hygenic"; while Lisp's 4efmacro ones are rather more low-level. This is like the old C++/C comparison: the hygenic ones are far harder to shoot yourself in the foot, but when you do, it takes your whole leg away.
There are some projects to do automatic conversion, including just having a large body of macros to load into Scheme, but it's a lot harder to translate from Lisp to Scheme than from a simple language like Tcl to Scheme, so I don't think they're very advanced. If you have a large body of code in Lisp, try running it in Steel Bank Common Lisp (sbcl) or CMU CL. If it's a small body, make a copy, do some search and replace and then move through it to tidy up the remaining parts.