[Prev][Next][Index][Thread]

Re: Does my ideal language exist?



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: