;; The first three lines of this file were inserted by DrScheme. 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 fig.22.2) (read-case-sensitive #t) (teachpacks ()) (htdp-settings #(#t constructor repeating-decimal #f #t none #f ()))) ; An empty list has no parts. ; empty : a constant ; empty? : anything -> boolean ; A cons has two parts: first (a string) and rest (a los). ; cons : string los -> nelos ; first : nelos -> string ; rest : nelos -> los ; cons? : anything -> boolean #| (define (function-on-nelos L) ; L a nelos ; (first L) a string ; (rest L) a los ; (function-on-los (rest L)) whatever this returns ...) |# ; A los is either an empty-list or a nelos. #| (define (function-on-los L) ; L a los (cond [(empty-list? L) ...] [(nelos? L) (function-on-nelos L)] )) |# (define english (cons "hello" empty)) (define span-eng (cons "buenos dias" english)) (define heb-span-eng (cons "shalom" span-eng)) (define fhse (cons "bonjour" heb-span-eng)) (define afhse (cons "salaam" fhse)) (define dwarfs (cons "sleepy" (cons "sneezy" (cons "dopey" (cons "doc" (cons "happy" (cons "bashful" (cons "grumpy" empty))))))))