help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How the backquote and the comma really work?


From: Marcin Borkowski
Subject: Re: How the backquote and the comma really work?
Date: Tue, 14 Jul 2015 20:17:20 +0200

On 2015-07-12, at 22:33, Marcin Borkowski <mbork@mbork.pl> wrote:

> So, what about this?  It seems to work.  OTOH, I think it's not the most
> elegant thing possible, since there is some code duplication: mci/read
> has this: (:open-paren (mci/read-list-contents)) in a (a)case statement,
> and mci/read-list-contents has this: (:open-paren (setq next
> (mci/read-list-contents))).  Something tells my mathematical mind that
> there probably exists a cleaner approach.

Stupid me – again;-).  No wonder ‘mci/read-list-contents’ appears twice,
once, once in ‘mci/read’ and once in ‘mci/read-list-contents’ – it seems
there’s no other way (though I can’t prove it formally).

But now my problem is something different, and on a different level –
a “metaproblem” in a sense.  I’m still working on ‘mci/eval’; it now
supports ‘progn’ forms and ‘setq’, and I have ‘cons’, ‘car’ and ‘cdr’ as
symbols bound to their Elisp counterparts in the global environment of
my MCI, and when I have lambdas (and write ‘mci/apply’, which should be
relatively easy now), I’ll have more or less complete (though tiny)
Lisp.  I guess that adding backquote should be really straightforward
then.

So where’s the problem?  Well, it’s quite a lot of fun to put it all
together, and I’m learning a few things along the way, so it’s difficult
to resist the temptation to add more stuff.  Macros?  ‘cond’ forms?
‘while’ forms?  OTOH, my goal is *not* to recreate all Elisp (contrary
to Scheme, Elisp is far from minimalistic, for instance, it has *a lot*
of special forms which could, in principle, be macros - ‘if’, for
example, or ‘let’, or ‘let*’).  I definitely do not want to spend too
much time on this – adding lots of special forms would soon cease to be
fun, and once (and if!) I have macros, there’s really no use in adding
them; also, I want to move on to other things.

So now my question is: does it make sense to play around with it more?
Would a more complete Elisp interpreter written in Elisp be useful for
anyone?  If yes, I might consider publishing all my code sooner rather
than later.  And: if it’s interesting and/or useful for anybody, is
there anything besides lambdas, a proper ‘mci/apply’ function and macros
that definitely *should* be added?  (One thing that comes to mind would
be special (= dynamic) variables.  I’m not sure whether I would like to
add them – it might be too much work.  OTOH, I’d learn to implement
dynamic binding then...)

Best,

-- 
Marcin Borkowski
http://octd.wmi.amu.edu.pl/en/Marcin_Borkowski
Faculty of Mathematics and Computer Science
Adam Mickiewicz University



reply via email to

[Prev in Thread] Current Thread [Next in Thread]