<br><br><div class="gmail_quote">On Sun, Nov 8, 2009 at 22:43, dsimcha <span dir="ltr"><<a href="mailto:dsimcha@yahoo.com">dsimcha@yahoo.com</a>></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'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'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'd prefer zip to return std.typecons.Tuples, even if that means stopping at the shortest range. That'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'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're wondering how unpack works and don't want to grovel through all the<br>
code, it's tons of string mixin magic. That's about the only way I was able to<br>
make it work.<br>
</blockquote></div><br>I'll read it with pleasure(!). I'm there to learn anyway.Heck, I can't read my own string mixins a week after writing them, so it'll be a good exercise.<br><br>As to making it an addition to std.range, I'm all for it. If people don'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's not awful.<br>
<br> Philippe<br><br>