CJS:

Unfortunately my current best attemp doesn't compile:

What errors are you seeing?


auto cross(R1, R2)(in R1 A, in R2 B){

Better to add a space before the open brace.
Also you may want to remove "in" if you want to use cross() on lazy ranges.


    return cartesianProduct(A,B).map!(ab => ab[].text).array;

And a space after the comma.


    string letters = "ABCDEFGHI";
    string digits = "123456789";

And a enum/const/immutable for variables that don't need to change.


        unitlist ~= cross(rows, to!string(c));

to!string(c)   ===>   c.text


        units[s] = filter!(x=>any!(y=>(s==y)))(unitlist);

Better to use UFCS here, don't forget spaces around operators:

units[s] = unitlist.filter!(x => any!(y => (s == y)));

And filter returns a lazy range, so perhaps that doesn't work.


For the associative arrays I'm unsure I have the correct calls, but they looked reasonable. Any suggestions?

Phobos needs a very handy set().

Bye,
bearophile

Reply via email to