SO rotate question

bearophile bearophileHUGS at lycos.com
Fri Sep 3 04:35:30 PDT 2010


Pelle:

> bool isRotated(T)(T[] a, T[] b) {
>      return a.length == b.length && (a.length == 0 || 
> canFind(chain(a,a), b));
> }

Nice clean solution. I suggest to add "pure" and two "const" in the signature.


> canFind isn't really the best possible name, is it?

Some name/APIs of Phobos are not the best possible, they were often invented by a single person. I don't know if contains() or isIn() are better.

Bye,
bearophile


More information about the Digitalmars-d-learn mailing list