[Challenge] implementing the ambiguous operator in D

Philippe Sigaud philippe.sigaud at gmail.com
Wed Sep 1 13:08:12 PDT 2010


Hey, this question on SO makes for a good challenge:

http://stackoverflow.com/questions/3608834/is-it-possible-to-generically-implement-the-amb-operator-in-d

The amb operator does this:

amb([1, 2]) * amb([3, 4, 5]) == amb([3, 4, 5, 6, 8, 10])
amb(["hello", "world"]) ~ amb(["qwerty"]) == amb(["helloqwerty", "worldqwerty"])
amb(["hello", "world"]) ~ "qwerty" == amb(["helloqwerty", "worldqwerty"])
amb(["hello", "very long string"]).length = amb([5, 16])


(I find the guy examples much more comprehensible that the articles he links
to)

Are people interested in trying this?

Peter, can we discuss your solution here?


Philippe
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.puremagic.com/pipermail/digitalmars-d/attachments/20100901/d2d59557/attachment.html>


More information about the Digitalmars-d mailing list