complete chapter 3 notes
authordaniel watson <ozzloy@gmail.com>
Wed, 17 Aug 2016 03:24:26 +0000 (20:24 -0700)
committerdaniel watson <ozzloy@gmail.com>
Wed, 17 Aug 2016 03:24:26 +0000 (20:24 -0700)
notes.org

index 10afb31cbf6a3135d171cb5aa31d90debfd40413..1c781009dec70bdbb4cbc17d95c113fe93db2f6b 100644 (file)
--- a/notes.org
+++ b/notes.org
       this creates a structure
     * fields: name, id#, dorm
     * (equal? (student-name freshman1) 'Joe)
+*** nesting structures
+    * (struct student-body (freshmen sophomores juniors seniors))
+    * (define all-student (list a b) (list) (list c d) (list e))
+    * a b c d e can all be student struct instances
+    * nested selectors:
+      * (student-name (first (student-body-freshmen all-students)))
+*** structure transparency
+    * default is opaque
+    * opaque means comparison is by identity not value
+    * (equal? false (equal? (student 'joe 1 'dorm) (student 'joe 1 'dorm)))
+    * (equal? true (equal? freshman1 freshman1))
+    * transparent structs are compared on value
+    * create transparent struct type: (struct a (b) #:transparent)
+    * (equal? true (equal? (a 'b) (a 'b)))
+    * (define b (a b))
+    * (equal? true (equal? b b))
+    * all structures in book are transparent
+**** checkpoint
+     * basic data: booleans, symbols, numbers, strings
+     * lists
+     * structs
+     * nesting of lists and structs