;; Thanks to Paul on the PLT Educators mailing list for ;; providing this Racket rendition of "I'm my own Grandpa" http://www.youtube.com/watch_popup?v=6H-OD6CFoDI ;; a ftn is either ;; 'unknown, or ;; (make-person String ftn ftn) (define-struct person (name father mother)) ;; Just me and my dad (define DAD (make-person "Dad" 'unknown 'unknown) (define ME (make-person "Me" DAD 'unknown)) ;; The pretty widow with a red-haired daughter (define WIDOW (make-person "Widow" 'unknown 'unknown)) (define REDHEAD (make-person "Redhead" 'unknown WIDOW)) ;; I marry the widow and become a father-in-law (set-person-father! REDHEAD ME) ;; Dad marries the Redhead and gains two in-laws (set-person-mother! DAD (person-mother REDHEAD)) (set-person-father! DAD (person-father REDHEAD)) ;; Now, "I'm my own Grandpa!" (eq? (person-father (person-father ME)) ME)