-
Notifications
You must be signed in to change notification settings - Fork 0
/
363.rkt
34 lines (28 loc) · 1.26 KB
/
363.rkt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
;; 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-intermediate-lambda-reader.ss" "lang")((modname 363ex) (read-case-sensitive #t) (teachpacks ()) (htdp-settings #(#t constructor repeating-decimal #f #t none #f () #f)))
;; Exercise 363
;; ------------
;; All elements of Xexpr.v2 start with a Symbol, but some are followed by a list
;; of attributes and some by just a list of Xexpr.v2s. Reformulate the
;; definition of Xexpr.v2 to isolate the common beginning and highlight the
;; different kinds of endings.
;;
;; Eliminate the use of List-of from Xexpr.v2.
;; -----------------------------------------------------------------------------
; An Xexpr.v2 is a list:
; – (cons Symbol Body)
; – (cons Symbol (cons [List-of Attribute] Body))
; where Body is short for [List-of Xexpr.v2]
; An Attribute is a list of two items:
; (cons Symbol (cons String '()))
; Xexpr.v3 is a (cons Symbol XexprContent)
;
; XexprContent is a list:
; - (cons Body '())
; - (cons AttributeList Body)
; where Body is short for [List-of Xexpr.v3]
;
; AttributeList is a [List-of Attribute]
; An Attribute is a list of two items:
; (cons Symbol (cons String '()))