Subject: Re: cons-stream definition
From: rpw3@rigden.engr.sgi.com (Rob Warnock)
Date: 11 Apr 2001 09:33:28 GMT
Newsgroups: comp.lang.scheme
Message-ID: <9b18d8$8tte8$1@fido.engr.sgi.com>
Andrew <none> wrote:
+---------------
| In UMB scheme, there if the following macro:
| (defmacro cons-stream (. args)
|   (quasiquote (cons (unquote (car args)) (delay (unquote (cadr args))))))
| I tried pasting it into dr.scheme, but I get a syntax error: "can't put
| `.' as first item in list" when trying to execute it.
| My question is this: is there a way to get the correct definition for
| cons-stream into Dr.scheme?
+---------------

There was a long thread here some time ago about what "( . foo)" should
mean, if anything, and the only choice that's consistent with the other
cases (especially lambda lists) is simply "foo". That is, try this:

  (defmacro cons-stream args
    `(cons ,(car args) (delay ,(cadr args))))

But I don't understand why you (or UMB Scheme) are using a variadic
macro to call a function with a fixed number of args. Why not simply this:

  (defmacro cons-stream (x y)
    `(cons ,x (delay ,y)))


-Rob

-----
Rob Warnock, 31-2-510		rpw3@sgi.com
SGI Network Engineering		<URL:http://reality.sgi.com/rpw3/>
1600 Amphitheatre Pkwy.		Phone: 650-933-1673
Mountain View, CA  94043	PP-ASEL-IA