Approximate overview
name->sortable(define name->sortable
(let ([space-before (lambda (str) (if str (string-append " " str) ""))]
[space-after (lambda (str) (if str (string-append str " ") ""))])
(lambda (name)
(let ([prefix (name-prefix name)]
[given (name-given name)]
[middle (name-middle name)]
[family (name-family name)]
[suffix (name-suffix name)])
(cond
; Normal case: They have a family name. It comes first.
[family
(string-append family
", "
given
(space-before middle)
(space-before suffix)
(space-before prefix))]
; Special case: Royalty and Religious, generalized
[(not middle)
(string-append (space-after prefix)
given
(space-before suffix))]
; Special case: No family but middle
[else
(string-append given
(space-before middle)
(space-before suffix)
(space-before prefix))])))))
;; Acknowledgements:
;; List of space related words that helped me create my syllex
;; https://relatedwords.io/space
;;
;; Racket documentation for `member,` which was really useful for the maddish libs
;; https://docs.racket-lang.org/reference/pairs.html
;; Project Gutenburg record of Alice's Adventures in Wonderland by Lewis Caroll
;; https://www.gutenberg.org/ebooks/11
;;
;; PDF covering diphthongs and vowel combos that was helpful in counting syllables
;; https://www.waikato.ac.nz/__data/assets/pdf_file/0005/314456/Word-lists-for-Vowels-Diphthongs.pdf
;; PDF describing one particularly programatic syllable-counting method
;; https://www.howmanysyllables.com/syllable_rules/howtocountsyllables
;; Presentation showing how to identify silent E's
;; https://ckla.amplify.com/skillsboost/wp-content/uploads/2020/08/G3_TeacherExtension_W1_D4.pdf
;; Using `map` instead of recursion
;; Mentor session with Micah
When using struct do we ever have to use define or does struct
serve as the definition?
structimplicitly defines all the procedures (the constructor, the basic predicate, the extractors, mutators if we permit them, etc.)
Can you summarize the main idea in the precondition testing reading?
Sometimes programmers provide incorrect parameters to the procedures we create. We may want to issue an error when that happens. We can use the
errorprocedure to do that.
Why didn’t you have us do preconditions earlier?
Um … I’m not sure.
Why would I create a new data type when I could just put data in a pre-existing structure like lists, vectors or hash-tables?
Data abstraction! This takes us further along the path that “the implementation doesn’t/shouldn’t matter”.
It’s less work to write
(struct foo (a b c))than to write the five procedures that command generates.
Data protection / program safety. Client programmers can’t do things with our structures other than what we permit. (More or less.) If you use a hash table or a vector, clients might be able to mutate them when we don’t want them to.
Do you plan to distribute grade reports soon?
Yes; sometime this weekend.
I like CS. What should I take next year.
CSC-161, Imperative Problem Solving, is the next course in our introductory sequence.
CSC-207, Objects, Data Structures, and Algorithms, follows 161.
If you are considering a CS major, you might also look toward MAT/CSC-208 or MAT-218, which rovide the mathematical foundations of CS. (Taking one of the two is required for the major.)
;SAM SAID I CAN STOP HERE