From: John Thingstad
Subject: Read eval
Date: 
Message-ID: <oprwvnb1q7xfnb1n@news.chello.no>
I aam working with corman lisp under emacs.
Therfore I wish to extend the language with some read macro's to make it
more like Allgro lisp:


:ls
:pwd
:load <file>
:cd  <file>

This is as far as i get:

(defun ls ()
   (let* ((dir-string (namestring (current-directory)))
	 (search-string (concatenate 'string dir-string  "/*"))
	 (files (directory (truename search-string))))
     (dolist (file files)
       (fresh-line)
       (princ (concatenate 'string (pathname-name file) "." (pathname-type 
file))))
     (terpri)
     (values)))

(defun pwd ()
   (write-line (namestring (current-directory))))

(defun cd (dir)
   (check-type dir string)
   (setf (current-directory) dir)
   (values))

(define-symbol-macro :pwd (current-directory))
(define-symbol-macro :ls (ls))

How do I go about allowing ':cd <file>' (without sting double quotes)
I tried with (set-macro-character #\: #'colon-dispach) but had trouble
with read..
Anyone have any experience with this they wish to share?

-- 
Using M2, Opera's revolutionary e-mail client: http://www.opera.com/m2/
From: Frode Vatvedt Fjeld
Subject: Re: Read eval
Date: 
Message-ID: <2hllrrsx99.fsf@vserver.cs.uit.no>
John Thingstad <··············@chello.no> writes:

> I aam working with corman lisp under emacs.  Therfore I wish to
> extend the language with some read macro's to make it more like
> Allgro lisp: [..]

I believe that in Allegro and other systems, the top-level commands
are embedded in the REPL loop, they are not implemented as macros
(reader or symbol). This is what enables the practical
(i.e. paren-less) syntax, and you should see if this is at all
possible in your situation also.

Something roughly like this:

  (let ((forms (read-all-forms input)))
    (if (keywordp (first forms))
        (apply (find-toplevel-comand (first forms))
               (rest forms)) ; the arguments are not evaluated
      (dolist (form forms)
        (eval form))))

-- 
Frode Vatvedt Fjeld