Question: ;; Design a function that consumes a course and produces the numbers of ;; all courses in the tree that: ;; have an odd course

;; Design a function that consumes a course and produces the numbers of
;; all courses in the tree that:
;; have an odd course number, and
;; are not pre-requisites for any other courses in the tree, and
;; are worth at least 3 credits.
;;
;; You should produce a design for a single top-level function called
;; three-criteria-courses, below is my coding: ;@problem7
(define (three-criteria-courses c)
(cond
[(empty? c) empty]
[else
(local
[(define (fn-for-course c) ;
(cons (course-number c)(fn-for-loc (course-dependents c))))
(define (fn-for-loc loc)
(cond
[(empty? loc) empty]
[else
(cond
[cons (fn-for-course (first loc))(fn-for-loc (rest loc))])]))
;helper function to filter the an odd number course list
(define (filter-an-odd c)
(filter (lambda (x)(odd? x) c)))]
(cond
[(and (course? c)(equal? LOC0(course-dependents c)))
(filter-an-odd (courses-w-credits c 3))]
;helper function to filter the an odd number course list
;filter the list of course where the dependents is null, return this list.
[(and (course list? )(map (lambda (x)(equal? LOC0(last (course-dependents x))))))
((all-course-numbers c))]))]))
My code as above could not run, how to rectify it??

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!