;; about the language level of this file in a form that our tools can easily process.
#reader(lib "htdp-intermediate-reader.ss" "lang")((modname |LAB 6|) (read-case-sensitive #t)
(teachpacks ()) (htdp-settings #(#t constructor repeating-decimal #f #t none #f () #f)))
(require 2htdp/image)
(define-struct sentence (name subs))
;; Sentence is (make-sentence String ListOfSentence)
;; interp. a sentence representing a single part of the tree with
;; name the sentence itself
;; subs the list of sub-sentences within the sentence
;; ListOfSentences is one of:
m
;; - empty
er as
;; - (cons Sentence ListOfSentence)
co
;; interp. a list of sentences
eH w
o.
(define joking (make-sentence "joking about jealousy" empty))
rs e
(define you (make-sentence "you really mean it" empty))
ou urc
(define in (make-sentence "in a book to school special about mono" empty))
(define perched (make-sentence "perched on the tip of a sinking boat" empty))
(define freez (make-sentence "freeze time" empty))
o
(define my (make-sentence "my favourite song on repeat" empty))
aC s
(define it (make-sentence "it is your last chance" empty))
vi y re
(define we-are (make-sentence "we are" (list in perched)))
(define like (make-sentence "like" (list it you we-are)))
(define to (make-sentence "to" (list freez my)))
ed d
(define kiss-me (make-sentence "kiss me" (list joking like to)))
ar stu
#;#;
(define (fn-for-sentence s)
is
(... (sentence-name s)
Th
(fn-for-los (sentence-subs s))))
(define (fn-for-los los)
(cond [(empty? los) (...)]
sh
[else
(... (fn-for-sentence (first los))
(fn-for-los (rest los)))]))
This study source was downloaded by 100000805705997 from CourseHero.com on 10-14-2021 21:04:54 GMT -05:00
https://www.coursehero.com/file/21394492/LAB-6rkt/