[plt-scheme] Lispish system in Scheme

From: Ivanyi Peter (pivanyi at freemail.hu)
Date: Thu Jun 22 07:56:09 EDT 2006


Is there any simple implementation of Lisp in Scheme? I have
to do that but it does not seem to be too straightforward.
For example I would like to achieve that every variable has
a default
value, for example the empty list. I tried the following:

(define orig-eval (current-eval))
(define (lisp expr)
    ((identifier? expr)
     (orig-eval (namespace-variable-value (syntax-e expr) #t
(lambda () '() )))
      (orig-eval expr)
(current-eval lisp)

If I try this in DrScheme it works if I simply type a
symbol. However it
does not work in an expression like: (cons 1 anything)
I suspect the lisp evaluator is not called recursively.
Moreover I got it
work only as above, where expr is "maybe" a syntax object or
(Maybe I did not understand the documentation but something
else is
said there.) I also did not manage to "get into" this syntax
object, for
example to examine whether it is a list, if it is whether
the first element
in the list is a symbol and whether it is a function. (What
I would need
to write my own interpreter.)

I would appreciate any help, explanation, sample
implementation or
more detailed documentation.

(As I use DrScheme more and more and try to use new features
in it,
I have realised that I a really miss very simple demo programs. 
I always have to search collects directory, and somtimes it
sometimes I found too complicated pieces of codes which I
cannot use,
etc. I know there is HtDP and a tons of other, but I mainly
offline and if I do not have them on the machine I cannot
access them.
I would prefer to have these in the PLTScheme docs.
Sorry for rambling, just a suggestion.)

Thanks for any help,

Peter Ivanyi

Focivébé helyett: csajos filmek egy kattintásra!

Posted on the users mailing list.