1 ;; The first three lines of this file were inserted by DrScheme. They record metadata
2 ;; about the language level of this file in a form that our tools can easily process.
3 #reader(lib "htdp-beginner-reader.ss" "lang")((modname 11.2.4) (read-case-sensitive #t) (teachpacks ((lib "draw.ss" "teachpack" "htdp") (lib "arrow.ss" "teachpack" "htdp"))) (htdp-settings #(#t constructor repeating-decimal #f #t none #f ((lib "draw.ss" "teachpack" "htdp") (lib "arrow.ss" "teachpack" "htdp")))))
6 ;2. (cons dl empty) where dl is a deep-list.
8 ;depth : deep-list -> number
9 ;Consumes a deep-list dl and determines how many
10 ;cons were used to construct it.
13 ;(depth (cons (cons (cons 'food empty) empty) empty))
15 ;(depth (cons 'food empty))
23 [(cons? dl) (+ 1 (depth (first dl)))]))
26 ;(define dl1 (cons (cons (cons 'food empty) empty) empty))
28 ;make-deep : symbol natural-number -> deep-list
29 ;Consumes word and n to produce a deep-list
30 ;containing word constructed using n cons's.
34 ;(cons (cons (cons 'hey empty) empty) empty)
41 ;(define (make-deep word n)
44 ; [(> n 0) ... (make-deep word (sub1 n))]))
46 (define (make-deep word n)
49 [(> n 0) (cons (make-deep word (sub1 n)) empty)]))