Subject: Re: cons-stream definition
From: (Rob Warnock)
Date: 11 Apr 2001 09:33:28 GMT
Newsgroups: comp.lang.scheme
Message-ID: <9b18d8$8tte8$>
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 Warnock, 31-2-510
SGI Network Engineering		<URL:>
1600 Amphitheatre Pkwy.		Phone: 650-933-1673
Mountain View, CA  94043	PP-ASEL-IA