;; 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-cons) (read-case-sensitive #t) (teachpacks ()) (htdp-settings #(#t constructor repeating-decimal #f #t none #f ()))) ; A list-of-num is either ; - empty ; - (cons num list-of-num) ; aq-weight : list-of-num -> num ; Sums the fish weights in l (define (aq-weight l) (cond [(empty? l) 0] [(cons? l) (+ (first l) (aq-weight (rest l)))])) (check-expect (aq-weight empty) 0) (check-expect (aq-weight (cons 2 empty)) 2) (check-expect (aq-weight (cons 5 (cons 2 empty))) 7)