#lang racket
(define(rectangleList list rectangle1)(recursion list rectangle1'()))
;(define rectangleList(list '(2 4 6 1)'(1 8 4 4)'(0 5 4 0)))
;(define rectangle1 '(1 3 5 2))
(define(recursion rectangleList rectangle1 returnedList)
(if(<(length rectangleList)1)
returnedList
(recursion(cdr rectangleList) rectangle1
(if(Intersect(car rectangleList)rectangle1)
(cons (car rectangleList) returnedList)
returnedList
)
)
) )
(define(Intersect rectangleList rectangle1)
(and(and(<(car rectangleList) (cadr rectangle1)))
(and(> (cadr rectangleList) (car rectangle1)))
(and(< (cdr rectangleList)(caddr rectangle1)))
(and(> (caddr rectangleList) (cdr rectangle1)))))
I am having a problem with calling my racket code. I am unsure how to proceed. The code is taking a list of rectangles and then also taking a rectangle and seeing if the singular rectangle intersects with any of the other rectangles in the list. Then it should output the list of rectangles that it intersects with i.e Test Cases.
Problem Statement: Given a rectangle, R, and a list of rectangles, L, return the list containing the elements in L that intersect with R.
Any help on this matter would be greatly appreciated! :)