[plt-scheme] Contract case... but not case->

From: Paulo J. Matos (pocmatos at gmail.com)
Date: Fri Jul 10 08:08:44 EDT 2009

Hi all,

I need to say something like:
(case-dom-> 
    (A . -> . A)
    (B . -> . B))

to say, hey, this is a function that may receive an A or a B. If it
receives an A, then result must be an A, if it's a B then result must be
a B.

Any tips?

Initially I though case-> would do the trick but case-> is for
case-lambda expressions which won't work if the several cases have the
same number of arguments.

Cheers,

Paulo Matos



Posted on the users mailing list.