;; The first three lines of this file were inserted by DrRacket. They record metadata ;; about the language level of this file in a form that our tools can easily process. #reader(lib "htdp-beginner-reader.ss" "lang")((modname aq) (read-case-sensitive #t) (teachpacks ()) (htdp-settings #(#t constructor repeating-decimal #f #t none #f ()))) ; A list-of-num is either ; - empty ; - (make-bigger-list num list-of-num) (define-struct bigger-list (first rest)) ; aq-weight : list-of-num -> num ; Sums the fish weights in l (define (aq-weight l) (cond [(empty? l) 0] [(bigger-list? l) (+ (bigger-list-first l) (aq-weight (bigger-list-rest l)))])) (check-expect (aq-weight empty) 0) (check-expect (aq-weight (make-bigger-list 2 empty)) 2) (check-expect (aq-weight (make-bigger-list 5 (make-bigger-list 2 empty))) 7)