Newsgroups: comp.lang.lisp
From: cyber_surfer@wildcard.demon.co.uk (Cyber Surfer)
Path: cantaloupe.srv.cs.cmu.edu!das-news2.harvard.edu!news2.near.net!news.mathworks.com!udel!gatech!swrinde!pipex!peernews.demon.co.uk!wildcard.demon.co.uk!cyber_surfer
Subject: Re: Compiling series in Allegro 4.2
References: <3f68de$efs@wonder.irst.it>
Organization: The Wildcard Killer Butterfly Breeding Ground
Reply-To: cyber_surfer@wildcard.demon.co.uk
X-Newsreader: Demon Internet Simple News v1.27
Lines: 38
X-Posting-Host: wildcard.demon.co.uk
Date: Fri, 20 Jan 1995 10:36:05 +0000
Message-ID: <790598164snz@wildcard.demon.co.uk>
Sender: usenet@demon.co.uk

In article <3f68de$efs@wonder.irst.it>
           franconi@irst.it "Enrico Franconi " writes:

> I understand that in Cltl2 functions like "compiler-let" are no more
> present. However, the code of the Series Package heavily relies on this
> function. No problem - you would say - since in Allegro 4.2 such (and other)
> symbol is still in a package named "CLTL1". So, I used that package in the
> definition of the "SERIES" package, and I was able to successfully compile
> it. However, when I run the test file, I still get errors.

I've not tried this myself, but someone else gave this compiler-let
definition in a reply to a similar question:

(defmacro compiler-set (vars values)
  (mapc #'set vars values)
  '(progn))

(defmacro compiler-unset (vars)
  (mapc #'makunbound vars)
  '(progn))

(defmacro compiler-let (bindings &body body)
  (lisp:let* ((vars (mapcar #'(lambda (x) (if (atom x) x (car x))) bindings))
	      (old-vars (remove-if-not #'boundp vars))
	      (new-vars (remove-if #'boundp vars))
	      (old-values (mapcar #'symbol-value old-vars))
	      (new-values (mapcar #'(lambda (x) (if (atom x) nil (eval (cadr x)))) bindings)))
    `(unwind-protect
	 (progn (compiler-set ,vars ,new-values)
		(progn ,@ body))
       (compiler-set ,old-vars ,old-values)
       (compiler-unset ,new-vars))))

Please let me know if this works!
-- 
CommUnity: http://www.demon.co.uk/community/index.html
CommUnity: ftp://ftp.demon.co.uk/pub/archives/community
Me: http://cyber.sfgate.com/examiner/people/surfer.html
