;; 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 sum-numbers) (read-case-sensitive #t) (teachpacks ()) (htdp-settings #(#t constructor repeating-decimal #f #t none #f () #f))) ; A ListOfNumbers is one of: ; - empty ; - (cons Number ListOfNumbers) ; process-lon : ListOfNumbers -> ... (define (process-lon a-lon) (cond [(empty? a-lon) ...] [(cons? a-lon) (... (first a-lon) (process-lon (rest a-lon)) ...)])) ; sum-numbers : ListOfNumbers -> Number ; returns the sum of all the numbers in the given list ;(define (sum-numbers a-lon) ...) (check-expect (sum-numbers empty) 0) (check-expect (sum-numbers (cons 1 (cons 2 empty))) 3) (check-expect (sum-numbers (cons 3 (cons 1 (cons 4 (cons 7 empty))))) 15) (define (sum-numbers a-lon) (cond [(empty? a-lon) 0] [(cons? a-lon) (+ (first a-lon) (sum-numbers (rest a-lon)))]))