#lang racket (require "cad.rkt" syrup) (define (explain-cad shortname description) (displayln (format "** Shortname: ~a**" shortname)) (displayln "** Description: **") (pretty-print description) (displayln "** CAD: **") (displayln (format " ~a " (cadify shortname description))) (newline)) (displayln "==== Simple strings ====") (define sensitive-desc "\ The sensitive property (a boolean) on an object indicates \ that some users may wish to apply discretion about viewing its \ content, whether due to nudity, violence, or any other likely \ aspects that viewers may be sensitive to. This is comparable to \ what is popularly called \"NSFW\" (Not Safe For Work) or \ \"trigger warning\" in some systems. Implementations may choose \ to hide content flagged with this property by default, exposed at user discretion.") (explain-cad 'sensitive sensitive-desc) (displayln "==== Composite structures ====") (define ogre-desc `#hash((name . "Ogre") (desc . ((p "A large, bumbling beast..") (p (b "WARNING:") " Ogres get angry very quickly!"))) (habitats . ,(set "cave" "forest" "swamp" "dungeon")))) (explain-cad 'ogre ogre-desc) (displayln "==== Interface descriptions ====") (define parrot-string/iface '(-> string? positive-integer? string?)) (explain-cad 'parrot-string parrot-string/iface) (displayln "==== Composite actor descriptions, with interfaces ====") (define parrot-actor-desc (record* 'actor "Like a parrot, repeats everything back to you" (cadify 'parrot-string parrot-string/iface))) (explain-cad 'parrot-actor parrot-actor-desc)