<html>
<head>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=us-ascii">
<meta name=Generator content="Microsoft Word 11 (filtered)">
<style>
<!--
/* Font Definitions */
@font-face
{font-family:Tahoma;
panose-1:2 11 6 4 3 5 4 4 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0in;
margin-bottom:.0001pt;
font-size:10.0pt;
font-family:Arial;}
a:link, span.MsoHyperlink
{color:blue;
text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
{color:blue;
text-decoration:underline;}
span.Typed
{font-family:"Courier New";}
span.tty
{font-family:"Courier New";}
span.Name
{font-style:italic;}
span.Variable
{font-family:"Times New Roman";
font-style:italic;}
span.EmailStyle23
{font-family:Arial;
color:navy;}
@page Section1
{size:8.5in 11.0in;
margin:1.0in 1.25in 1.0in 1.25in;}
div.Section1
{page:Section1;}
-->
</style>
</head>
<body lang=EN-US link=blue vlink=blue>
<div class=Section1>
<p class=MsoNormal><span style='color:navy'>On Tuesday, December 04, 2007, Robert
Virding wrote:</span></p>
<div style='border:none;border-left:solid windowtext 1.0pt;padding:0in 0in 0in 4.0pt;
margin-left:.5in;margin-right:0in'>
<p class=MsoNormal style='border:none;padding:0in'>What I want is something
which *is* lisp even though it a lisp which has been designed to work
seamlessly together with *normal* Erlang. So it is more than just wrapping (
... ) around expressions after converting them into prefix form. So, for
example, there are no syntactic variables, you quote things which you don't
want to evaluate. So to comment some of you examples: </p>
</div>
<p class=MsoNormal><span style='color:navy'> </span></p>
<p class=MsoNormal><span style='color:navy'>I like your idea. Is your idea to
compile Lersp to Erlang or straight to the virtual machine (BEAM files?)?</span></p>
<p class=MsoNormal><span style='color:navy'> </span></p>
<p class=MsoNormal><span style='color:navy'>Cheers,</span></p>
<p class=MsoNormal><span style='color:navy'> </span></p>
<p class=MsoNormal><span style='color:navy'>David</span></p>
<p class=MsoNormal><span style='color:navy'> </span></p>
<div>
<div class=MsoNormal align=center style='text-align:center'>
<hr size=2 width="100%" align=center tabindex=-1>
</div>
<p class=MsoNormal><b><span style='font-family:Tahoma'>From:</span></b><span
style='font-family:Tahoma'> erlang-questions-bounces@erlang.org
[mailto:erlang-questions-bounces@erlang.org] <b>On Behalf Of </b>Robert Virding<br>
<b>Sent:</b> Tuesday, December 04, 2007 20:34<br>
<b>To:</b> YC<br>
<b>Cc:</b> Denis; Erlang-Questions (E-mail)<br>
<b>Subject:</b> Re: [erlang-questions] Lisp syntax for Erlang</span></p>
</div>
<p class=MsoNormal> </p>
<p class=MsoNormal>On 04/12/2007, <b>YC</b> <<a
href="mailto:yinso.chen@gmail.com">yinso.chen@gmail.com</a>> wrote:</p>
<div>
<blockquote style='border:none;border-left:solid #CCCCCC 1.0pt;padding:0in 0in 0in 6.0pt;
margin-left:4.8pt;margin-right:0in'>
<p class=MsoNormal> </p>
<div>
<p class=MsoNormal>IMHO, the issues above arise from the goal being unclear: is
it a lispy syntax for erlang or is it a lisp in erlang? </p>
</div>
</blockquote>
<div>
<p class=MsoNormal style='margin-bottom:12.0pt'><br>
I have tried to be clear, but obviously not succeeded. I am going to do a lisp
syntax for Erlang, not implement CL or Scheme which, by the way, is *very*
difficult on the BEAM today. That is the main problem as I have to invent lisp
constructions which match into Erlang. </p>
</div>
<blockquote style='border:none;border-left:solid #CCCCCC 1.0pt;padding:0in 0in 0in 6.0pt;
margin-left:4.8pt;margin-right:0in'>
<div>
<div>
<p class=MsoNormal>If it's a lispy syntax, IMO a prefix<->infix
transformer can handle a lot of cases (below uses vector for tuples): </p>
</div>
</div>
</blockquote>
<div>
<p class=MsoNormal><br>
What I want is something which *is* lisp even though it a lisp which has been
designed to work seamlessly together with *normal* Erlang. So it is more than
just wrapping ( ... ) around expressions after converting them into prefix
form. So, for example, there are no syntactic variables, you quote things which
you don't want to evaluate. So to comment some of you examples: </p>
</div>
<blockquote style='border:none;border-left:solid #CCCCCC 1.0pt;padding:0in 0in 0in 6.0pt;
margin-left:4.8pt;margin-right:0in'>
<p class=MsoNormal> </p>
<div>
<div>
<div>
<p class=MsoNormal>%% Erlang => ErlangInLisp <br>
A + 1, => (+ A 1) <br>
A = 5. => (= A 5).</p>
</div>
</div>
</div>
</blockquote>
<div>
<p class=MsoNormal><br>
This will become a (let ((a 5)) ... ). Let will be extended to match</p>
</div>
<blockquote style='border:none;border-left:solid #CCCCCC 1.0pt;padding:0in 0in 0in 6.0pt;
margin-left:4.8pt;margin-right:0in'>
<p class=MsoNormal> </p>
<div>
<div>
<div style='margin-left:24.0pt'>
<p class=MsoNormal>[foo | bar] => (| foo bar) </p>
</div>
</div>
</div>
</blockquote>
<div>
<p class=MsoNormal><br>
(cons 'foo 'bar) </p>
</div>
<blockquote style='border:none;border-left:solid #CCCCCC 1.0pt;padding:0in 0in 0in 6.0pt;
margin-left:4.8pt;margin-right:0in'>
<p class=MsoNormal> </p>
<div>
<div>
<div style='margin-left:24.0pt'>
<p class=MsoNormal>Pid ! Data => (! Pid Data) </p>
</div>
</div>
</div>
</blockquote>
<div>
<p class=MsoNormal><br>
(send pid data) ;Using symbols can sometimes be harder to
read</p>
</div>
<blockquote style='border:none;border-left:solid #CCCCCC 1.0pt;padding:0in 0in 0in 6.0pt;
margin-left:4.8pt;margin-right:0in'>
<p class=MsoNormal> </p>
<div>
<div>
<div style='margin-left:24.0pt'>
<p class=MsoNormal>A = {foo, bar}. => (= A #(foo bar)) %% or (= A {foo bar})
(either works fine, but vector version appears more uniform and in spirit of
lisp) </p>
</div>
</div>
</div>
</blockquote>
<div>
<p class=MsoNormal><br>
(let ((a #('foo 'bar))) ... ) ;or '#(foo bar) here </p>
</div>
<blockquote style='border:none;border-left:solid #CCCCCC 1.0pt;padding:0in 0in 0in 6.0pt;
margin-left:4.8pt;margin-right:0in'>
<p class=MsoNormal> </p>
<div>
<div>
<div style='margin-left:24.0pt'>
<p class=MsoNormal>fun(A) -> A + 1. => (lambda (A) (+ A 1)) %% I think
fun is fine. </p>
</div>
</div>
</div>
</blockquote>
<div>
<p class=MsoNormal><br>
Agree </p>
</div>
<blockquote style='border:none;border-left:solid #CCCCCC 1.0pt;padding:0in 0in 0in 6.0pt;
margin-left:4.8pt;margin-right:0in'>
<p class=MsoNormal> </p>
<div>
<div>
<div style='margin-left:24.0pt'>
<p class=MsoNormal>case A of foo -> {foo}; bar -> {foo, bar} end. =>
(case A ((foo) bar) ((bar) #(foo bar)))</p>
</div>
</div>
</div>
</blockquote>
<div>
<p class=MsoNormal><br>
As yours but quoted:<br>
(case a<br>
('foo #('bar))<br>
('bar #('foo 'bar))) </p>
</div>
<blockquote style='border:none;border-left:solid #CCCCCC 1.0pt;padding:0in 0in 0in 6.0pt;
margin-left:4.8pt;margin-right:0in'>
<p class=MsoNormal> </p>
<div>
<div>
<div style='margin-left:24.0pt'>
<p class=MsoNormal>foo(1) -> 2; foo(abc) -> {foo, bar}. => (defun foo
((1) 2) ((abc) #(foo bar))) </p>
</div>
</div>
</div>
</blockquote>
<div>
<p class=MsoNormal><br>
I was more into:<br>
<br>
(defun foo (arg)<br>
(case arg<br>
(1 2)<br>
(abc '#(foo bar)))) </p>
</div>
<blockquote style='border:none;border-left:solid #CCCCCC 1.0pt;padding:0in 0in 0in 6.0pt;
margin-left:4.8pt;margin-right:0in'>
<p class=MsoNormal> </p>
<div>
<div>
<div style='margin-left:24.0pt'>
<p class=MsoNormal>{ok, B} = mod:fun(). => (= #(ok B) (mod:fun))
or (= {ok B} ((: mod fun)))</p>
</div>
</div>
</div>
</blockquote>
<div>
<p class=MsoNormal><br>
(let ((#('ok b) (: mod fun))) ... ) ;see below </p>
</div>
<blockquote style='border:none;border-left:solid #CCCCCC 1.0pt;padding:0in 0in 0in 6.0pt;
margin-left:4.8pt;margin-right:0in'>
<p class=MsoNormal> </p>
<div>
<div>
<p class=MsoNormal>And keep the rest of the erlang syntax such as Camel casing
for variable, pattern matching built-in default, bare words as atoms unless at
the the head of a list (or unless in special syntax such as case), etc. </p>
</div>
</div>
</blockquote>
<div>
<p class=MsoNormal><br>
One feature of lisp we must keep is that code has he same form as data, *is*
data. That means that if we keep the Camel casing for variables then they have
to parse to something other than symbols. If they don't then we will forever be
parsing symbol names to discern what they are. That is why I would prefer to
use the lisp convention of evaluating everything *except* that which is quoted.
That means even using quotes in patterns. </p>
</div>
<blockquote style='border:none;border-left:solid #CCCCCC 1.0pt;padding:0in 0in 0in 6.0pt;
margin-left:4.8pt;margin-right:0in'>
<p class=MsoNormal> </p>
<div>
<div>
<p class=MsoNormal>The issue with (remote-call) is that it's tedious.
Think of having to write that for all function calls that don't live in the
current module namespace. And it also takes on meaning of apply/3. <br>
<br>
If mod:fun(Args) is writtten as (remote-call mod fun Args), then how to
write apply/3? <br>
<br>
Should we write apply(mod, fun, Args) as (apply (remote-call mod fun
Args))?? Then it's apply/1. <br>
<br>
Probably better to have remote-call take on the meaning of apply/3. I don't
think all function calls should go through apply. </p>
</div>
</div>
</blockquote>
<div>
<p class=MsoNormal><br>
My current working model is:<br>
<br>
mod:fun(<arg1>, <arg2>, <arg3>) ==> (module-call
'mod 'fun <arg1> <arg2> <arg3>)<br>
Mod:fun(<arg1>, <arg2>, <arg3>) ==>
(module-call mod 'fun <arg1> <arg2> <arg3>) <br>
Mod:Fun(<arg1>, <arg2>, <arg3>) ==>
(module-call mod fun <arg1> <arg2> <arg3>)</p>
</div>
<p class=MsoNormal><br>
with (: mod fun <arg1> <arg2> <arg3>) as a macro for the 1st
most common case. It smiles at you because it feels good to be so helpful. <br>
<br>
You will still need apply:<br>
<br>
apply(Fun, ArgList) ==> (apply fun arglist)<br>
apply(Mod, Fun, ArgList) ==> (apply mod fun arglist)<br>
<br>
Apply and module-call are proper functions which evaluate their arguments, : is
a macro which doesn't evaluate its first two arguments, the module name and
function name, but does evaluate the function arguments. <br>
<br>
We'll see where it all ends up,<br>
<br>
Robert</p>
</div>
<p class=MsoNormal> </p>
</div>
</body>
</html>