[Prev][Next][Index][Thread]
Re: Does my ideal language exist?
-
To: info-dylan@ai.mit.edu
-
Subject: Re: Does my ideal language exist?
-
From: Bruce Hoult <bruce@hoult.org>
-
Date: Mon, 26 Jun 2000 01:15:02 -0400 (EDT)
-
Organization: The Internet Group Ltd
-
References: <m34s82daqz.fsf@enterprise.newedgeconcept> <394EB8F3.E4D35698@hotdispatch.com> <39500e18@news.sentex.net> <bruce-74B8B2.12334623062000@news.akl.ihug.co.nz> <m3pup89i2v.fsf@localhost.localdomain> <bruce-DE48E2.20035025062000@news.akl.ihug.co.nz> <m3d7l6x9fe.fsf@localhost.localdomain> <bruce-B32A94.03220426062000@news.akl.ihug.co.nz> <m3vgyxy2se.fsf@localhost.localdomain> <bruce-AC0C77.16470126062000@news.akl.ihug.co.nz>
-
User-Agent: MT-NewsWatcher/3.0 (PPC)
-
Xref: traf.lcs.mit.edu comp.lang.misc:33279 comp.lang.forth:57142 comp.lang.clos:4995 comp.lang.dylan:12235
In article <bruce-AC0C77.16470126062000@news.akl.ihug.co.nz>, Bruce
Hoult <bruce@hoult.org> wrote:
> define macro with-collect
> { with-collect (?:name, ?more-names:*) ?:body end }
> => {let vals = #();
> local method ?name(item) vals := pair(item, vals) end;
> let (#rest results) = collect (?more-names) ?body end;
> apply(values, reverse!(vals), results);}
> { with-collect () ?:body end } => { ?body; values() }
> end;
Arrrgghh. I really should learn not to do last-minute edits before
posting. My macro was originally called "collect" and I edited it to
match yours at the last minute. But not *quite*...
define macro with-collect
{ with-collect (?:name, ?more-names:*) ?:body end }
=> {let vals = #();
local method ?name(item) vals := pair(item, vals) end;
let (#rest results) = with-collect (?more-names) ?body end;
apply(values, reverse!(vals), results);}
{ with-collect () ?:body end } => { ?body; values() }
end;
-- Bruce
Follow-Ups:
References: