<div class="gmail_quote">On Sun, Jul 18, 2010 at 06:19, Jonathan M Davis<span dir="ltr"></span> wrote:<br>*****<br>I think that the problem with find() is not so much find() but it&#39;s documentation.<br>In all honesty, anything with a return type like FindResult!(Range, Ranges) is<br>
going to scare people off. <br>*****<br><br>What should be done (in a perfect world) is to have a simplified signature that can become the complete signature on a click<br><br>auto find!()(haystack, needles)  =&gt;  FindResult!(etc.  ...<br>
the empty !() being a cue that it&#39;s a template function and that there is more to it that meets the eye.<br><br>(edit: crap, you said it afterwards. I should not reply hours after first reading a message)<br><br>*****<br>
If anything, I&#39;ve been more interested in canFind() and until() being made to<br>match up with find(). I&#39;d like to be able to give them both pretty much the same<br>arguments and then get the bool from canFind() and the range that find() would<br>
have walked over in the case of until(). A function which gave you both the<br>range that until() would have given you as well as the one which find() would<br>have given you would be nice as well. I previously opened a bug with thoughts<br>
along those lines: <a href="http://d.puremagic.com/issues/show_bug.cgi?id=3888">http://d.puremagic.com/issues/show_bug.cgi?id=3888</a><br>*****<br><br>Ah, these are called takeWhile, dropWhile and span, in Haskell and other sequence-heavy languages.<br>
Or splitBy, cutAt, etc. Quite handy to have, I agree std.algorithm should have them. But then, it&#39;s huge module already.<br><br><br>*****<br>In any case, I think that find() itself is more or less fine from a usage<br>
standpoint. It&#39;s the docs that need help. The other thing would<br>be to add a lot more examples. That would be a big boon for a lot of<br>std.algorithm functions. They&#39;re not necessarily hard to use, and the examples<br>
show it much more clearly than the signatures often do. <br>*****<br><br>I sometimes dream of a complement to Phobos that would demonstrate its use, either by providing lots of examples for each function or by taking a module and tackling a task with it. Obviously, as both a complement to Phobos and a way to demo-nstrate D, it should be called Deimos, the second moon of Mars, Phobos&#39; sibling.<br>
<br>Now, the Deimos Project, that&#39;s some cool name, if I may say so.<br><br>But I guess the wiki already does this.<br><br>Philippe<br><br><br></div>