On this page:
1.1 Rules
8.12

1 The jen Guide🔗ℹ

jen is a tool for procedurally generating text and other things. TODO

This guide is aimed at people with relatively little experience in Racket. It’s intended that you try the code in DrRacket as it comes up in the text.

1.1 Rules🔗ℹ

A rule is a value representing a way to generate something, which is the central concept in jen. Rules can be defined and applied like so:

The examples in this guide all begin the same way:

#lang racket
(require jen)

This tells Racket that we’re using the standard Racket language and importing the jen library. Since this text is necessary for all the examples, it’s included so you don’t need to remember to keep it in.

#lang racket
(require jen)
 
(define-simple-rule color
  "red"
  "blue")
 
(color)

When you run this program, you should see either "red" or "blue" in the interactions pane. (Try running the program again until you’ve seen both. You can also enter (color) into the interactions pane instead of running the whole program again.)