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

Re: A (possibly interesting) macro



    Date: 11 OCT 1980 1626-EDT
    From: BAK at MIT-AI (William A. Kornfeld)

    A definition of SEQ is:

    (defmacro seq (&rest forms &aux replacement)
      (mapc
        #'(lambda (form)
    	(setq replacement
    	  (cons (car form) (subst replacement '* (cdr form)))))
        forms)
      replacement)

[1] SUBST doesn't know anything about the semantics of lisp.
    So you should say (meta-eval form '(*) (list replacement)).
    [One such meta-evaluator is MC:LIBMAX;META >]
[2] (SEQ (FOO) (BAR * *)) causes multiple evaluation of (FOO).
    Its not really clear that thats what is intended, because
    SEQ looks like it might be implemented as

   (defmacro SEQ (&REST FORMS)
	     `(prog (*) ,@(mapcar #'(lambda (u) `(setq * ,u)) forms)
                    (return *)))

   Which I think is much more natural for the type of programming
   style. 

I think "*" in SEQ should act just like a variable, especially since
it looks so much like the "*" in the read-eval-print-loop.