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

Re: can s-exprs represent a graph without eval?




   Date: Thu, 19 Jun 2003 17:04:15 -0400 (EDT)
   From: Alan Bawden <Alan@LCS.MIT.EDU>
   To: Guy.Steele@sun.com
   CC: ll1-discuss@ai.mit.edu, geoff@knauth.org
   Subject: Re: can s-exprs represent a graph without eval?
   
      Date: Thu, 19 Jun 2003 16:07:25 -0400 (EDT)
      From: Guy Steele - Sun Microsystems Labs <Guy.Steele@sun.com>
      Cc: Guy.Steele@sun.com
   
      IIRC, Fred Blair, when he was working on IBM 370 Lisp back
      in the 1970s, actually put the analysis into the compiler
      to make it understand circular list structure in the code.
      So it would produce the same machine code for
   
      (prog (x)
   	 (setq x 3)
         #1=(cond ((equal x 0) . #2#)
   	       ((oddp x) (print x))
   	       (t (setq x (- x 1)) . #1#))
   	 (setq x (+ x 3))
         #2=(cond ((equal x 5) (return)))
   	 . #1#))
   
      and
   
      (prog (x)
   	 (setq x 3)
         A  (cond ((equal x 0) (go B))
   	       ((oddp x) (print x))
   	       (t (setq x (- x 1)) (go A)))
   	 (setq x (+ x 3))
         B  (cond ((equal x 5) (return)))
   	 (go A)))
   
      the point being the the first version would run a little faster
      when INTERPRETED.  Bleah.  De gustibus non disputandum.
   
      --Guy Steele
   
   Surely that should be:
   
      (prog (x)
   	 (setq x 3)
      . #1=((cond ((equal x 0) . #2#)
   		((oddp x) (print x))
   		(t (setq x (- x 1)) . #1#))
   	 (setq x (+ x 3))
      . #2=((cond ((equal x 5) (return)))
   	 . #1#))))
   
   - Alan

Too true.  I'm not doing so well today on the details, am I?

--Guy