<div>bearophile, Awesome! I'll take a look at the old D ports to see how they did it.</div><div><br></div><div>Çehreli, thanks much! Another D user suggested the same fixes at StackOverflow, so my project is making progress.</div>

<div><br></div>Fawcett, you've got the right idea :) The difference between your example code and QuickCheck is that your example looks more like assert statements, and QuickCheck's forAll() generates the assertions dynamically, by the hundreds. The API has you specifying only the property to be tested, and the generators for its input types. You're definitely on the right track.<div>

<div><br></div>Cheers,<div><br></div><div>Andrew Pennebaker</div><div><a href="http://www.yellosoft.us" target="_blank">www.yellosoft.us</a></div>
<br><div class="gmail_quote">On Tue, Oct 18, 2011 at 3:48 PM, Graham Fawcett <span dir="ltr"><<a href="mailto:fawcett@uwindsor.ca">fawcett@uwindsor.ca</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">

<div class="im">On Tue, 18 Oct 2011 15:06:21 -0400, Andrew Pennebaker wrote:<br>
<br>
> Recap:<br>
><br>
> forAll() accepts a property of type bool function(void), and a<br>
</div>> collection of generator functions, of types *arbitrary_type*<br>
<div class="im">> function(void). forAll calls the generator functions, storing the values<br>
> in another collection, and passing the values to the property. If the<br>
> property returns false, the values are printed to the screen.<br>
<br>
</div>A variadic forAll seems doable, e.g.<br>
<br>
  forAll!isEven(&my_ints, &my_floats, &my_ulongs);<br>
<br>
The types are not *entirely* arbitrary, right? Each has a return type Tn,<br>
constrained such that "isEven!Tn" must be a valid instance of the isEven<br>
template. so "forAll!isEven(&ints, &floats, &bananas)" would be invalid,<br>
assuming there's no legal "isEven!Banana" instance.<br>
<br>
It would look something like this (here with arrays, instead of lambdas):<br>
<br>
import std.stdio;<br>
<br>
bool isEven(T)(T v) {<br>
  return v % 2 == 0;<br>
}<br>
<br>
bool forAll(alias Pred, T...)(T seqs) {<br>
  bool result = true;<br>
  foreach(sequence; seqs) {<br>
    foreach(elem; sequence)<br>
      result &= Pred(elem);<br>
  }<br>
  return result;<br>
}<br>
<br>
void main() {<br>
  writeln(forAll!isEven([22, 22], [23L, 22L]));<br>
  writeln(forAll!isEven([2,4], [6.0,8.0], [10L,12L]));<br>
}<br>
<font color="#888888"><br>
Graham<br>
<br>
</font></blockquote></div><br></div>