On 1/4/11 6:32 AM, spir wrote:
On Mon, 03 Jan 2011 23:27:22 -0600
Andrei Alexandrescu<[email protected]>  wrote:

Nevertheless, I found two issues: one, ParameterTypeTuple doesn't work
for overloaded functions, and associative arrays don't work for ubyte[4]
keys... still a ways to go.

Could you or someone else expand on this?

Denis
-- -- -- -- -- -- --
vit esse estrany ☣

spir.wikidot.com


An example in Higher Order Perl is memoizing a RGB to CMYK function:

ubyte[4] rgb2cmyk(ubyte[3] rgb)
{
    ubyte[4] result = void;
    result[0] = cast(ubyte)(255 - rgb[0]);
    result[1] = cast(ubyte)(255 - rgb[1]);
    result[2] = cast(ubyte)(255 - rgb[2]);
    result[3] = min(result[0], result[1], result[2]);
    result[0] -= result[3];
    result[1] -= result[3];
    result[2] -= result[3];
    return result;
}

Trying to memoize this yields a range error at runtime.


Andrei

Reply via email to