# Reading your own home

From A Little Lisp for a Small World, the Plazmi Lisp book (https://plazmi.gg/book). Checked against Plazmi Lisp version 2, 12 November 2026. The whole book as one file: https://plazmi.gg/book.md

So far the plans have worked things out from values written in them. A few words read the world instead: your coins, your house, what you've put away, what's in your pack, the time and the sky. They only read, and only your own. This chapter uses them, and ends Part I with what a plan is, as a whole.

## Your coins

```clojure
(coins)
```

```text
50
```

`(coins)` is a number, so it goes into sums and tests like any other: `(>= (coins) 30)` asks whether you have 30 to spend. Juniper's home is new, so it has the 50 a new home is given.

## Your house

`(house)` is your house as data: a map, its rooms, its parts (the house calls them masses), its roof, its outside colours:

```clojure
(keys (house))
(:name (house))
(count (:rooms (house)))
(map :id (:rooms (house)))
```

```text
(…)
"Juniper's house"
4
("kitchen" "living" "bath" "bedroom")
```

Maps inside maps are read with `get-in`, or a chain of keywords with `->`:

```clojure
(-> (house) :masses first :roof :type)
(get-in (house) [:exterior :door])
```

```text
"gable"
"#…"
```

The shape is the house's own, and it is the shape the house's words change (chapter 15). Read it before you change it: which rooms there are, how steep the roof is, what colour the door.

## What you keep

`(storage)` is what you've put away, at home and on the playa, and `(materials)` what's in your pack, by name:

```clojure
(storage)
(materials)
(get (materials) "compost" 0)
```

```text
{:house [], :playa []}
{…}
…
```

## The time and the sky

Plazmi has its own clock and its own sky, the same for everyone. `(world-time)` is the time; `(sky)` is the sky as a resident looking up sees it; `(weather)` is the day as your garden has it:

```clojure
(world-time)
(:time (sky))
(:sky (weather))
(:season (weather))
```

```text
{:time "01:…", :day …, :dawn "06:00", :dusk "18:00"}
:night
:…
:…
```

`(:time (sky))` is one of `:dawn`, `:day`, `:dusk` and `:night`. `(:sky (weather))` is `:sunny`, `:hazy` or `:rain`, and `:clear` on a sunny day's night. `(sky)` holds more: the moon, the night's constellation, the stars that are out. These are the words a toy uses to greet you differently at night (chapter 11):

```clojure
(if (= :night (:time (sky))) "Good night." "Good day.")
```

```text
"Good night."
```

## What a plan is

You have seen enough now to say what a plan is, as a whole.

A plan is a list of steps, run in order. A step either changes something of yours (a roof, a toy, a dance, a design: Part II) or works something out. A step that only works something out answers its value, and the reply lists the answers, one a line, then says what changed at home:

```clojure
(coins)
(+ (coins) 10)
(str "I have " (coins) " coins.")
```

```text
50
60
"I have 50 coins."
Nothing at home changed.
```

Steps can sit inside `let`, `when`, `if` and `dotimes`, and each value worked out there is answered too:

```clojure
(dotimes [i 3]
  (* i 10))
```

```text
0
10
20
```

The whole plan is checked before any of it runs, and it runs all or nothing: if a step stops, nothing the plan did is kept. That is why a refused plan always ends "Nothing was changed."

An answer is cut short when it is very long: each value is shown up to 300 characters, and all of them together up to 1,200. `(house)` whole is longer than that, which is why this chapter read it a key at a time.

## Try it

1. Answer how many coins you'd have after spending 35, or `"not enough"` if you have fewer than 35.
2. Answer the names of your house's rooms as one text, joined with commas.
3. Answer `"Bonsoir."` at night and `"Bonjour."` otherwise.
4. Answer how many hours until dusk, using `(world-time)` and `parse-long`. (The time is written `"HH:MM"`.)

## Recap

- `(coins)`, `(house)`, `(storage)`, `(materials)`, `(world-time)`, `(sky)` and `(weather)` read your own home and the world's time. They change nothing.
- A plan is steps in order. A step that only works something out answers its value; the reply ends with what changed.
- A plan is checked whole, then runs all or nothing.

Part II makes things: first, a toy.


---

Before: [Chance that repeats](https://plazmi.gg/book/chance.md). Next: [A first toy](https://plazmi.gg/book/first-toy.md). Contents: https://plazmi.gg/book.md
