how to solve nested list programs [closed]
- by riya
write a function to get most popular car that accepts a car detail as input and returns the most popular car name along with its average rating .Each element of car details list is a sublist that provides the below information about a car (a)name of a car(b)car price (c) list of ratings obtained by car from various agencies.Incase two cars have the same average rating then the car with the lesser price qualifies as most popular car?
here's my solution-:
(define-struct cardetails ("name" price list of '(ratings))
(define car1 (make-cardetails "toyota" 123 '( 1 2 3)))
(define car2 (make-cardetails "santro" 321 '( 2 2 3)))
(define car3 (make-cardetails "toyota" 100 '( 1 2 3)))
(define cardetailslist(list(car1) (car2)(car 3)))
(let loop ((count 0))
(let (len (length cardetailslist))
(if(< count len)
(string-ref (string-ref n)0)
now please tell me how to find maximum average and display car name.it's not a homework question tomorrow is my test and we have not been taught this concept in class although it is very important from test point of view