[plt-scheme] [redex] matching question

From: Casey Klein (clklein at eecs.northwestern.edu)
Date: Fri Jun 4 14:48:55 EDT 2010

On Fri, Jun 4, 2010 at 1:14 PM, Eric Tanter <etanter at dcc.uchile.cl> wrote:
> Hi,
>
> I have a subtype? metafunction where one clause is as follows:
>
> ((subtype? C_0 C_1 CT)
>   #t
>   (side-condition (not (equal? (term C_0) (term Object))))
>   (where (C_0 C_2 any_1 any_2) (class-lookup C_0 CT))
>   (side-condition (not (equal? (term C_0) (term C_1))))
>   (side-condition (equal? (term C_2) (term C_1))))
>
> ie. C_0 is subtype of C_1 if C_0 directly inherits from C_1
>
> I find it redundant that I have to write the above, ie. introducing C_2 in the where clause to then check that C_2 and C_1 are equal.
>
> At first I wrote:
>
> ((subtype? C_0 C_1 CT)
>   #t
>   (side-condition (not (equal? (term C_0) (term Object))))
>   (where (C_0 C_1 any_1 any_2) (class-lookup C_0 CT))
>   (side-condition (not (equal? (term C_0) (term C_1)))))
>
> putting C_1 directly in the pattern of the where clause, but it did not work (that is to say, it always matched, even if the superclass was different from C_1).
>
> Can someone explain me why this is so?
>

John requested the same behavior a few months ago, and I agree it
would be very handy.  I'll try to implement it in the next few weeks.


Posted on the users mailing list.