I have been giving some thought to the problem of adding a "proper" lisp syntax for Erlang. Most of it is pretty straight forward. As someone mentioned earlier you compile for core Erlang and then use the compiler from then on.
<br><br>Some examples of a syntax based on Scheme:<br><br>(define (call pid request)<br>  (send pid #((self) 'request req))<br>  (receive<br>    (#(pid1 'reply rep) (when (= pid pid1)) rep)))<br><br>Using Scheme vector syntax for tuples. I suppose you could also use { ... }. Now a function from termite:
<br><br>(define (!? pid req)<br>  (let ((tag (make_ref)))<br>    (send pid #((self) tag req))<br>    (receive<br>      ((tag1 rep) (when (= tag tag1)) rep))))<br><br>And how the days_in function discussed a few days ago could look:
<br><br>(define (days_in month leap?)<br>  ;; Match month and leap?<br>  (case #(month leap)<br>    ((1 l) 31)<br>    ((2 'true) 29)<br>    ((2 'false) 28)<br>    ... ))<br><br>Some comments:<br><br>- must use all conventions from the rest of Erlang so have true/false instead of #t/#f
<br>- proper variable scoping<br>- re-use some Scheme forms but modified for Erlang<br>- (case ...) extended to match against pattern not test value<br>- use quotes in patterns **<br>- guards are (when <tests>) directly after a pattern
<br>- use case for head matching, could add an extra form (match ...) which does the same thing but different error value<br>- unpacking explicit #( ... ) build in case is not difficult<br>- can use Scheme atom syntax as it will allow (almost) any Erlang atom, don't think you can quote an atom in Scheme
<br><br>The difficult bit I think is getting modules and inter-modules calls right. R6 Scheme has modules, or libraries as they call them, but they don't work the same as Erlang modules. They allow you to import libraries, but they must be known at compile time, and specify a prefix within an atom to refer to a library. But I don't see how they directly support a construction like Module:func(...) with out using an apply:
<br><br>    (apply module 'func args)<br><br>There is no problem for the compiler to detect when args is known at compile time and generate better code. If anyone knows how they mean this to be done tell me. Otherwise apply is not needed.
<br><br>Macros at this level are easy using (define-syntax ...).<br><br>At this level the only major difference between using CL or Scheme as a base for Elisp is how functions are bound to symbols, as there value or in a special slot. Apart from that there would be very little difference. I actually prefer defun/defmacro instead of define/define-syntax but not enough to really mind.
<br><br>It is important to note that we are not implementing Scheme (or CL) but providing a lisp based syntax for Erlang. There are too many things in lisp which we can't do at all in Erlang, especially destructive operations (not set!, which is easy). 
N.B. Scheme in Haskell and Luke's Scheme in Erlang don't do this. :-)<br><br>Anyway these are some thoughts on the subject,<br><br>Robert<br><br>** This is strange. In all examples I have seen in lisp books where they develop a logic language in lisp they go the other way, they specially mark (logical) variables in some way, for example ?var. I mean why add an inconsistency by reversing it?