;; structure representing homework points
;; nr: number - the number of the homework
;; points: number - the number of points reached
(define-struct homework (nr points))
;; parse-homework: (list of number pairs) -> (list of homework)
;; The procedure takes a list of number pairs and produces a list of homework structures
;; Example: (parse-homework (list (list 1 6) (list 2 7) (list 3 0))) should produce (list (make-homework 1 6) (make-homework 2 7) (make-homework 3 0))
(define (parse-homework homework-entries)
(if (and (= (length (first homework-entries) 2))(= (length (parse-homework (rest homework-entries)) 2)))
(make-homework (first homework-entries) (parse-homework (rest homework-entries)))
(error 'Non-valid-input "entered list is not of length two"))
)
(parse-homework (list (list 1 6) (list 2 7) (list 3 0)))
This code produces the error length: expects 1 argument, given 2: (list 1 6) 2
I really appreciate every explanation that you can give me to get in in this scheme-stuff...
Thank you very much