<br><br><div class="gmail_quote">On Sun, Nov 8, 2009 at 22:43, dsimcha <span dir="ltr">&lt;<a href="mailto:dsimcha@yahoo.com">dsimcha@yahoo.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<br>
Hot off the press and VERY prototype-ish:<br>
<br>
Code:<br>
<a href="http://pastebin.com/m2087e524" target="_blank">http://pastebin.com/m2087e524</a><br>
<br>
Docs:<br>
<a href="http://cis.jhu.edu/%7Edsimcha/unpackEnumerate.html" target="_blank">http://cis.jhu.edu/~dsimcha/unpackEnumerate.html</a><br>
<br></blockquote><div>Cool! Thanks a lot.<br> <br>I looked at opApply for D1 maybe two years ago, but never used it myself. I&#39;ll go and read this part of the docs.<br><br>*test it*<br><br>Hmm, I can get enumerate to work, but the Unpack part doesn&#39;t compile. It complains <a href="http://elem.at">elem.at</a>!(0) is not an lvalue.<br>
<br>You know, the Proxy part of std.range.zip is really annoying. I&#39;d prefer zip to return std.typecons.Tuples, even if that means stopping at the shortest range. That&#39;s what other languages do and it seems enough for most uses.<br>
<br><br></div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Does this look like a good addition to std.range?  The elegance of it is it solves<br>
the problem of providing syntactic sugar to ranges w/ zero ripple effects either<br>
in the compiler or in the rest of Phobos.  I&#39;ll file it somewhere more official<br>
after people review it a little and refine the idea, but I definitely think<br>
something similar to this has a legit place in std.range.<br>
<br>
If you&#39;re wondering how unpack works and don&#39;t want to grovel through all the<br>
code, it&#39;s tons of string mixin magic.  That&#39;s about the only way I was able to<br>
make it work.<br>
</blockquote></div><br>I&#39;ll read it with pleasure(!). I&#39;m there to learn anyway.Heck, I can&#39;t read my own string mixins a week after writing them, so it&#39;ll be a good exercise.<br><br>As to making it an addition to std.range, I&#39;m all for it. If people don&#39;t want to use it because they are leery of using opApply, too bad for them. Your small benchmark was interesting: overhead exists, but it&#39;s not awful.<br>
<br>  Philippe<br><br>