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

From: Robby Findler (robby at eecs.northwestern.edu)
Date: Fri Jul 10 08:12:08 EDT 2009

If A (or B) are flat contracts, then you can use ->d, but if A and B
are both function contracts, then that can get tricky and the contract
language doesn't support it.


On Fri, Jul 10, 2009 at 7:08 AM, Paulo J. Matos<pocmatos at gmail.com> wrote:
> 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
> _________________________________________________
>  For list-related administrative tasks:
>  http://list.cs.brown.edu/mailman/listinfo/plt-scheme

Posted on the users mailing list.