Formulas are little utilities embedded in your notes. They work a lot like formulas in a spreadsheet without the need for a whole table.

Formulas can do standard math stuff like add and subtract numbers, they can get the value of a bean between two dates, and they can do lots of surprising things when combined with other Tap functions.

There are a few different categories of functions:

Each on their own are fairly abstract, but through combination their usefulness grows.

Here are a few examples:

```
$$()(+ 1 1)
```

This adds 1 and 1 and renders "2" in our note

We can give the formula a name:

```
$$("Add one and one")(+ 1 1)
```

This renders "Add one and one: 2" in our note

We can harness the power of the unknown using `random`

.

```
$$("Roll of the dice")(random 1 6)
```

We can flip a coin:

```
$$("The coin flipped")
(list-item
(list "heads" "tails")
(random 0 1))
```

That last one took a big leap, let's break it down.

```
$$()(list "heads" "tails")
```

This will create a list with two items: "heads" and "tails". It will show up in the note as "heads, tails".

```
$$()(list-item (list "heads" "tails") 0) -> always renders "heads"
$$()(list-item (list "heads" "tails") 1) -> always renders "tails"
```

By introducing chaos from the universe we will randomly select "heads" or "tails"

```
$$("The coin flipped")
(list-item
(list "heads" "tails")
(random 0 1))
```

The note will show up as "The coin flipped: heads" OR "The coin flipped: tails" depending on certain mystic forces beyond anyone's control.

Why we would want a note that flips a coin, I don't know. Here's another formula of questionable utility.