person.matzo 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. gender:= Male | Female | Unspec;
  2. fn byGender[m,f,n] => fn {
  3. [Male] => m;
  4. [Female] => f;
  5. [_] => n;
  6. };
  7. ending := byGender["o","a","e"];
  8. pronoun := byGender["he","she","they"];
  9. noun := byGender["man","woman","person"];
  10. are := byGender["is","is","are"];
  11. have := byGender["has", "has", "have"];
  12. cons ::= p t c d g r l m n x;
  13. vowel ::= a e i o u;
  14. fn name[g] => (vowel | "") rep[1..3, cons vowel] cons ending[g];
  15. hairColor ::= black brown blonde;
  16. eyeColor ::= brown green blue;
  17. fn job[g] =>
  18. "stonemason"
  19. | "baker"
  20. | "accountant"
  21. | case g in
  22. { Male => "fisherman"
  23. ; Female => "fisherwoman"
  24. ; _ => "fisher"
  25. };
  26. fn tool { ["stonemason"] => "chisel"
  27. ; ["baker"] => "bowl"
  28. ; ["accountant"] => "tablet"
  29. ; [_] => "fishing pole"
  30. };
  31. adjective ::= happy cheerful focused quiet meek rash;
  32. person :=
  33. let fix my-gender := gender;
  34. fix my-job := job[my-gender] in {
  35. se[
  36. "You come across",
  37. str/capitalize[name[my-gender]],
  38. ", a",
  39. noun[my-gender],
  40. "from the city of",
  41. str/capitalize[name[Female]]
  42. "."
  43. ]
  44. " "
  45. se[
  46. pronoun[my-gender],
  47. are[my-gender],
  48. "a hardworking",
  49. my-job,
  50. "with",
  51. hairColor,
  52. "hair and",
  53. eyeColor,
  54. "eyes."
  55. ]
  56. " "
  57. se[
  58. pronoun[my-gender],
  59. have[my-gender],
  60. "a",
  61. tool[my-job],
  62. "and",
  63. are[my-gender],
  64. "very",
  65. adjective,
  66. "."
  67. ]
  68. };
  69. puts person;