@@ -1,126 +1,221 @@ (include "lib/lisp-macro.scm") +(include "lib/fail.scm") (include "lib/interlace.scm") (include "lib/bot.scm") - -(define (fail . msg) - (display (string-append "\x1b[1;31m - err.\x1b[0m " - (apply string-append msg))) - (exit 1)) -(define (fail:sym s) - (fail "bad form \x1b[3;36m'" (symbol->string s) "\x1b[0m")) - -(define-macro (fn . b) (cons 'lambda b)) ; your honor, they made me do it - -(define (verb inf ger pst ppl) - (fn (form) - (define (is f) (equal? form f)) - (cond - ((is 'inf) inf) ((is 'ger) ger) - ((is 'pst) pst) ((is 'ppl) ppl) - (else (fail:sym form))))) - -(define (word-append . body) - (define (vowel? c) (member c '("a" "e" "i" "o" "u"))) - (define (join acc lst) - (if (eq? lst '()) acc - (let ([word (car lst)] - [tail (cdr lst)]) - (if (eq? word '()) (join acc tail) - (join (string-append acc (if (equal? acc "") "" " ") - (if (not (equal? word "a")) word - (if (eq? tail '()) "a" - (let* ([next-word (car tail)] - [onset (substring next-word 0 1)]) - (if (vowel? onset) "an" "a"))))) tail))))) - (join "" body)) - - -(define-macro (verb-form . body) - (define (make-id . body) - (string->symbol (apply string-append body))) - - (define (finalize-rule r) - (define (finalize-sub-rule s) - (if (list? s) `(string-append ,@s) s)) - (let* ([rule-name (car r)] - [rule-body (cdr r)]) - `(define (,rule-name *o*) - (word-append ,@(map finalize-sub-rule rule-body))))) - - (let* ([proc-def (car body)] - [proc-name (symbol->string (car proc-def))] - [proc-args (cdr proc-def)] - [defs (cdr body)]) - - `(define (,(make-id "verb:" proc-name) ,@proc-args) - ,@(map finalize-rule defs) (verb inf ger pst ppl)))) - -(link-vector 'words - fuck: (verb:weak "fuck") - clench: (verb:weak "clench") - '(verb:weak "download") - '(verb:weak "cyber")) - -(define (phrase vb pp) - (lambda (form) - (if (equal? form 'ppl) - (lambda (*o*) - (word-append (string-append ((vb 'ppl) '()) "-" pp) *o*)) - (lambda (*o*) - (word-append ((vb form) *o*) pp))))) - -(verb-form (weak stem) - ; e.g. suck → sucking - (inf [stem] *o*) - (ger [stem "ing"] *o*) - (pst [stem "ed"] *o*) - (ppl [stem "ed"] *o*)) - -(verb-form (e stem) - ; e.g. vape → vaping - (inf [stem "e"] *o*) - (ger [stem "ing"] *o*) - (pst [stem "ed"] *o*) - (ppl [stem "ed"] *o*)) - -(verb-form (heavy stem final) ; e.g. plug → plugging - (inf [stem final] *o*) - (ger [stem final "ing"] *o*) - (pst [stem final "ed"] *o*) - (ppl [stem final "ed"] *o*)) - -(verb-form (strong stem pst ppl) ; e.g. drink → drank - (inf [stem] *o*) - (ger [stem "ing"] *o*) - (pst [pst] *o*) - (ppl [ppl] *o*)) - -(verb-form (strong! stem pst) ; e.g. shoot → shot → shot - (inf [stem] *o*) - (ger [stem "ing"] *o*) - (pst [pst] *o*) - (ppl [pst] *o*)) - - - - (verb:weak "crunch") - (verb:weak "snort" "snorting") - (verb:heavy "stab" "b") - (verb:strong "drink" "drank" "drunk") - (verb:strong "eat" "ate" "eaten") - (verb:strong "bite" "bit" "bitten") - (verb:strong! "shoot" "shot") - - )) - -(define verbs (interlace vector +(include "lib/struct.scm") +(include "lib/verb.scm") + +(define (forms fn vb . args) + (list->vector (map (lambda (a) (fn vb a)) args))) + +(define (flexprep vb . args) + (list->vector + (append (map (lambda (x) postpositive vb x) args) + (map (lambda (x) phrase vb x) args)))) + + +(define intransitive-verbs (interlace vector + (forms phrase + (verb:strong "get" "got" "gotten") "up" "off" "out") + (verb:weak "leak") + (verb:weak "scream") + (verb:weak "fear") + hurt. (verb:strong! "hurt" "hurt") + (forms postpositive + hurt "bad" "real bad" "like hell" + "something awful" "something fierce" + "something terrible" "real good") + + (forms postpositive + (verb:weak "jerk") "it" "off") + + (forms phrase (verb:strong "throw" "threw" "thrown") + "up" "down") + )) + +(define vocab:roa-verbs (interlace vector + get. (verb:strong "get" "got" "gotten") + (forms phrase + get "up" "off" "out" "in") + (forms postpositive + get "in" "in on" "out of" "up in" "into" + "off on" "over" "over to") crunch. (verb:weak "crunch") - (phrasal crunch "up") - (phrasal crunch "off") - (phrasal crunch "out") - (phrasal crunch "away") + (flexprep crunch "up" "off" "out" "away") + (postpositive crunch "on") + cyber. (verb:weak "cyber") + (flexprep cyber "up") + slurp. (verb:weak "slurp") + (flexprep "up") + suck. (verb:weak "suck") + (flexprep suck "up" "off" "down") + throw. (verb:strong "throw" "threw" "thrown") + (flexprep throw "up") + (postpositive throw "back") + chew. (verb:weak "chew") + (flexprep chew "up") + (postpositive chew "on") + have. (verb:irregular "have" "has" "having" "had" "had") + do. (verb:irregular "do" "does" "doing" "did" "done") + poop. (verb:weak "poop") + (flexprep poop "out") + (postpositive poop "on") + piss. (verb:weak "piss") + (postpositive piss "on") + (flexprep piss "out" "away" "off") + cook. (verb:weak "cook") + (phrase cook "up") + tweet. (verb:weak "tweet") + (forms phrase tweet "up" "at") + plug. (verb:heavy "plug" "g") + (phrase plug "in") + (postpositive (verb:weak "laugh") "at") + (flexprep (verb:weak "hook") "up" "in") + (flexprep (verb:weak "turn") "on" "in") + + (verb:weak "download") + (verb:weak "snort") + (verb:weak "sniff") + (verb:weak "down") + (verb:weak "hoot") + (verb:weak "toot") + (verb:weak "boof") + (verb:weak "blast") + (verb:weak "honk") + (verb:weak "whack") + (verb:weak "loot") + (verb:weak "slaughter") + (verb:weak "ghoul") + (verb:es "ravish") + (verb:es "piss") + (verb:es "crunch") + (verb:e "scrobbl") + (verb:e "chok") + (verb:e "blaz") + (verb:e "freebas") + (verb:e "us") + (verb:e "vap") + (verb:e "smoke") + (verb:e "gargle") + (verb:e "guzzle") + (verb:e "mainlin") + (verb:y "tr") + (verb:heavy "stab" "b") + (verb:heavy "pop" "p") + (verb:heavy "zap" "p") + (verb:heavy "slug" "g") + (verb:strong "drink" "drank" "drunk") + (verb:strong "eat" "ate" "eaten") + (verb:strong "bite" "bit" "bitten") + + shoot. (verb:strong! "shoot" "shot") + (phrase shoot "up"))) + +(define person (struct '1sg '1pl '2 '3sg.f '3sg.m '3pl 'inan)) +(define declension (struct 'nom 'acc 'gen 'poss 'refl 'cop)) +(define pronoun (apply person (map declension '( + ("i" "me" "my" "mine" "myself" "i'm" + ("we" "us" "our" "our" "ourself" "we're") + ("you" "you" "your" "yours" "yourself" "you're") + ("she" "her" "her" "hers" "herself" "she's") + ("he" "him" "his" "his" "himself" "he's") + ("they" "them" "their" "theirs" "themselves" "they're" ) + ("it" "it" "its" "its" "itself" "it's" )))))) + +(define (look-up st . path) + (if (eq? '() (cdr path)) (st (car path)) + (look-up (st (car path)) (cdr path)))) + + +(define collapse-person (person '1sg 'pl '3sg '3sg 'pl)) +; not all person forms are contrastive in english; this +; way we only have to encode the ones that contrast + +; state: a function that is called on a person, a tense +; (one of 'pst 'prs 'fut 'perf 'imperf), an aspect +; ('stat 'inch), and returns a string of text describing +; the person in that state +; e.g. (outta-mind '3sg.f 'prs 'stat) → "is outta her mind" +; (suicidal '3sg.m 'fut 'stat) → "is gonna want to die" + +(define (adjective pers tense aspect) + + +(define (pick-rec top-list) ; note: do not expose to + (let ([e (pick top-list)]) ; empty vectors + (if (vector? e) (pick-rec e) e))) + +(define verb:be (let ([t (struct 'inf 'pst)] + [p (struct '1sg '3sg 'pl)]) + (t (p "am" "is" "are") + (p "was" "was" "were")))) + + +(define noun:sg (vector "a" "the" "this")) +(define noun:pl (vector "" "the" "these")) +(define noun:mass (vector "" "the" "this")) +(define noun:pn (vector "")) + +(define nouns + (let* ([$ string-append] [: cons] [@ list] + [~ (lambda (str lst) (list->vector (map (lambda (fn) (fn str)) lst)))] + [sg (lambda (n) (: n noun:sg))] + [pl (lambda (n) (: ($ n "s") noun:pl))] + [pl/s (lambda (n) (: ($ n "es") noun:pl))] + [pl/i (lambda (p) (lambda (_) (: p noun:pl)))] + [pl/iso(lambda (n) (: n noun:pl))] + [mass (lambda (n) (: n noun:mass))] + [mass/i(lambda (m) (lambda (_) (: m noun:mass)))] + [pn (lambda (n) (: n noun:pn))]) + (vector + (~ "water" [@ mass pl]) + (~ "shoe" [@ sg pl]) + (~ "man" [@ sg (pl/i "men") (mass/i "Man")]) + (~ "mouth" [@ sg pl]) + (~ "ass" [@ sg pl/s]) + (~ "dick" [@ sg pl mass]) + (~ "cock" [@ sg pl mass]) + (~ "cunt" [@ sg pl mass]) + (~ "pussy" [@ sg mass (pl/i "pussies")]) + (~ "eyeball" [@ sg pl]) + (~ "bed" [@ sg pl]) + (~ "house" [@ sg pl]) + (~ "home" [@ mass pl]) + (~ "pants" [@ pl/iso]) + (~ "face" [@ sg pl]) + (~ "friend" [@ sg pl]) + (~ "pal" [@ sg pl]) + (~ "buddy" [@ sg (pl/i "buddies")]) + (~ "vomit" [@ mass]) + (~ "phone" [@ sg pl]) + (~ "pig" [@ sg pl]) + (~ "cop" [@ sg pl]) + (~ "human" [@ sg pl]) + (~ "God" [@ pn]) + (~ "god" [@ sg pl]) + (~ "goddess" [@ sg pl/s]) + (~ "asshole" [@ sg pl]) + (~ "clown" [@ sg pl]) + (~ "fear" [@ mass]) + (~ "person" [@ sg (pl/i "people")])))) +; TODO: second-order verbs +#| +(define (verb-phrase tense noun) + (let* ([verb (pick-rec transitive-verbs)] + [noun-form (pick noun)] + [det (pick (cdr noun-form))] + [bare-noun (car noun-form)]) + ((verb tense) (word-append det bare-noun)))) + +(define (mod-noun noun) + (let* ([mode (one-of (cons transitive-verbs 'ppl) + (cons intransitive-verbs 'adj))] + [noun-form (pick noun)] + [bare-noun (car noun-form)] + [verb (pick-rec (car mode))] + [vbd-noun ((verb (cdr mode)) bare-noun)]) + (vector (cons vbd-noun (cdr noun-form))))) - fuck. (verb:weak "fuck") - (phrasal fuck "up") - (phrasal fuck "out") - (phrasal fuck "off"))) +(print "in this house, we " (verb-phrase 'inf (mod-noun (pick nouns)))) +(exit 0) +|#