Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!uunet!husc6!sri-unix!ctnews!pyramid!hplabs!decwrl!labrea!russell!evan From: evan@russell.STANFORD.EDU (Evan Kirshenbaum) Newsgroups: comp.lang.scheme Subject: CScheme question Message-ID: <430@russell.STANFORD.EDU> Date: Wed, 14-Oct-87 21:36:49 EDT Article-I.D.: russell.430 Posted: Wed Oct 14 21:36:49 1987 Date-Received: Sat, 17-Oct-87 18:04:20 EDT Reply-To: evan@russell.UUCP (Evan Kirshenbaum) Organization: Center for the Study of Language and Information, Stanford U. Lines: 33 I recently started using CScheme, and I have a question about the efficiency of the compiler. When writing macros, a common idiom I use is: `(lambda ,args (let (,@(and var1 `((,var1 ,(generate-uninterned-symbol)))) ,@(and var2 `((,var2 ,(generate-uninterned-symbol)))) ...) ...)) where temporary variables are gensymed only if they are needed. If no variables are needed, what comes out is (lambda (x y z) (let () ...)) Now in any other lisp/scheme the internal let binding would be discarded. In CScheme, it would seem that the internal environment would have to be created because of the way define works. I use this idiom a lot, and wind up with functions that pp as (let () (let () ...)). My question is: is the compiler smart enough to realize that no defines occur in the body, and so no environment is needed, or do I have to make macros condition on the presence/absence of temporary variables? --- Evan Kirshenbaum Stanford University evan@CSLI.STANFORD.EDU ...!{ucbvax,decvax}!decwrl!glacier!evan If you think my opinions represent this university, you haven't been on campus recently!