Hey guys and gals!!! first time for me posting on this forum!!! I'm currently learning scheme and for some reason I can't seem to get anything to work correctly. I've been trying to define the union of 2 lists in scheme and its not working. I'm not sure how to compare each element in a list and if they are the same, then only outputting one of the elements. for example if i call the function (union '(a b c) '(c d e)) it should return (a b c d e).

heres some code:

(define union

(lambda (A) (D)) -- is this correct for inputting two lists?

(if eq? A(car D) -- is this correct for comparing elements in the two lists?

(return append ((A) (D)) -- is this correct for joining two lists?

any help would be greatly appreciated!! i've been working on this for 3 hours and can't seem to think of anything that would work.