### 1` `The jen Guide

TODO

One of the simplest jen programs that produces output is:

(require jen) (define-rule start (~> "hello friend :3")) (start)

This always gives "hello friend :3". But jen is designed to give random results, so it’s more interesting to try rules with multiple alternatives:

(require jen) (define-rule start (~> "hello friend :3") (~> "greetings friend :3")) (start)

Now when you run the program, you’ll get either "hello friend :3" or "greetings friend :3", randomly. Try running it multiple times to see, or, if you’re using an interactive evaluator such as DrRacket, run just (start) over and over.

Some of the text in this rule is fixed, meaning it’s the same for all (both) alternatives. We can avoid writing it more than once by factoring out part of this rule into a second rule:

(require jen) (define-rule start (~> (greeting) " friend :3")) (define-rule greeting (~> "hello") (~> "greetings")) (start)

There’s nothing special about the names of rules. greeting is just as much a rule as start is. The only difference is we apply (start) directly and not (greeting). Try applying (greeting) yourself and see if it works as you expect.

We can even generalize this further and get multiple independently random parts:

(require jen) (define-rule start (~> (greeting) " " (friend) " :3")) (define-rule greeting (~> "hello") (~> "greetings")) (define-rule friend (~> "friend") (~> "amigx")) (start)

Now, there are four possible results, one for every combination of the two choices that can be made for each of the two independent rules, greeting and friend. Try running (start) until you see them all.

Try adding more possibilities to greeting and friend yourself, or factoring ":3" out and adding more possible emotes.

TODO