Code in the racket language a function that will take two in
Code in the racket language a function that will take two input lists such as below and output the boolean values like the example below.
Input: (1, 2, 3, 4, 5) and (1, 6, 3, 2)
Output: (T, F, T, F)
| Input: (1, 2, 3, 4, 5) and (1, 6, 3, 2) Output: (T, F, T, F) |
Solution
(define (check listA listB)
(for ([i my-length listA])
(if (eq? (list-ref listA i) (list-ref listB i)) T (error) F)
)
)
(define (my-length lst)
(cond
[(empty? lst) 0]
[else (+ 1 (my-length (rest lst)))]))
