Re: [racket-users] Determining if 2 lists share a common element

2019-11-14 Thread Laurent
On Thu, Nov 14, 2019 at 3:11 AM Andrew wrote: > I have this: > > (define (related? a1 a2) > (if (equal? a1 a2) > true > (related? (member (rest ("proc that calls list" a1)) (rest ("proc > that calls list" a2))) > (member a1 ("proc that calls list" a2)) > I can't make s

[racket-users] Determining if 2 lists share a common element

2019-11-14 Thread Luis Sanjuán
As for the lists sub-problem, a for loop can do the job: (for*/or ([x (in-list list-1)] [y (in-list list-2)]) (equal? x y)) Alternatively, since duplicated elements don't matter, you can check the intersection: (not (set-empty? (set-intersect list-1 list-2))) -- You received this message beca

Re: [racket-users] Determining if 2 lists share a common element

2019-11-13 Thread George Neuner
On 11/13/2019 10:11 PM, Andrew wrote: I have this: (define (related? a1 a2) (if (equal? a1 a2) true (related? (member (rest ("proc that calls list" a1)) (rest ("proc that calls list" a2))) (member a1 ("proc that calls list" a2)) a1 and a2 are part of a binary

[racket-users] Determining if 2 lists share a common element

2019-11-13 Thread Andrew
I have this: (define (related? a1 a2) (if (equal? a1 a2) true (related? (member (rest ("proc that calls list" a1)) (rest ("proc that calls list" a2))) (member a1 ("proc that calls list" a2)) a1 and a2 are part of a binary search tree and I have another function that