14The `:dojo` is the place to quickly experiment with Urbit. On the
15surface the `:dojo` is just a Hoon REPL. On the inside, the `:dojo` is a
16system for operating on and transforming data in Urbit.
24Evaluate a hoon expression:
26 ~your-urbit:dojo> (add 2 2)
27 ~your-urbit:dojo> %+ add 2 2
29Tall form Hoon may require multiple lines:
31 ~your-urbit:dojo> %+ add
35Use `=var` to save a shell variable:
37 ~your-urbit:dojo> =foo (add 2 2)
39Use `=dir` to set the current working directory:
41 ~your-urbit:dojo> =dir %/web
43Generators (files in `/gen`) are run with `+`:
45 ~your-urbit:dojo> +hello 'world'
47Save output to a file in `%clay` with `*`:
49 ~your-urbit:dojo> *some/file/path/hoon 'hello world'
51Run system commands from `:hood`, like `reload`, using `|`:
53 ~your-urbit:dojo> |reload %eyre
57**`+cat`** - Similar to Unix `cat`. Accepts a path.
59 ~your-urbit:dojo> +cat %/web/md
60 ~your-urbit:dojo> +cat /~talsur-todres/home/2/web/notes/md
62**`+curl`** - Similar to Unix `curl`. Accepts a `tape`.
64 ~your-urbit:dojo> +curl "http://nyt.com"
66**`+hello`** - Just prints the argument. Accepts a `@ta`.
68 ~your-urbit:dojo> +hello 'mars'
70**`+ls`** - Similar to Unix `ls`. Accepts a path.
72 ~your-urbit:dojo> +ls %/web
73 ~your-urbit:dojo> +ls /~talsur-todres/home/2/web/notes
75**`+moon`** - Generate a random moon from a planet. No arguments.
77 ~your-urbit:dojo> +moon
79**`+solid`** - Compile the current state of the kernel and output a
80noun. Usually downloaded to a file in unix. No arguments.
82 ~your-urbit:dojo> .urbit/pill +solid
84**`+ticket`** - Generate a ticket for an Urbit plot. Takes an Urbit name
87 ~your-urbit:dojo> +ticket ~talsur-todres-your-urbit
89**`+tree`** - Generate a recursive directory listing. Takes a path.
91 ~your-urbit:dojo> +tree %/web
95The hood is the system daemon. See `gen/hood` and `app/hood`.
97**`|hi`** - Sends a direct message. Sort of like Unix `write`. Accepts
98an urbit name (`@p`) and a string (`cord`).
100 ~your-urbit:dojo> |hi ~dozbud "you there?"
102**`|link`** / **`|unlink`** - Link / unlink a remote app. Accepts an
103Urbit name and an app name.
105 ~your-urbit:dojo> |link ~talsur-todres %octo
107**`|mass`** - Prints the current memory usage of all the kernel modules.
110 ~your-urbit:dojo> |mass
112**`|reload`** - Reloads a kernel module (vane) from source. Accepts any
115 ~your-urbit:dojo> |reload %clay %eyre
117**`|reset`** - Reloads `hoon.hoon` and all modules. No arguments.
119 ~your-urbit:dojo> |reset
121**`|start`** - Starts an app. Accepts an app name.
123 ~your-urbit:dojo> |start %curl
127<h3 class="first child">
131A dojo command is either a source or a sink. A source is just something
132that can be printed to your console or the result of some computation. A
133sink is an *effect*: a change to the filesystem, a network message, a
134change to your environment, or typed message to an app.
136Sources can be chained together, but we can only produce one effect per
141#### `=` - Set variable
143Set any envronment variable:
145 ~your-urbit:dojo> =foo 42
146 ~your-urbit:dojo> (add 2 foo)
150(There are a few special variables that the dojo maintains. See below.)
152#### `:` - Send to app
154`:app` goes to a local `app`, `:~ship/app` goes to the `app` on `~ship`.
156Send a `helm-hi` message to `hood`:
158 ~your-urbit:dojo> :hood &helm-hi 'hi'
160App usually expect marked data, so `&` is often used here.
162#### `*` - Save in `%clay`
164Save a new `md` file in `web`:
166 ~your-urbit:dojo> *%/web/foo/md '# hello'
168The last component of the path is expected to be the mark (or mime
171#### `.` - Export to Unix
173Export a noun to Unix with `.`:
175 ~your-urbit:dojo> .foo/bar/baz (add 2 2)
177Which creates a file at `pier/.urb/put/foo/bar.baz`.
179This is very often used with `+solid`:
181 ~your-urbit:dojo> .urbit/pill +solid
183Which outputs a new `urbit.pill` to `pier/.urb/put/urbit.pill`
187#### `&` - Mark conversion
189Convert between marks using `&`:
191 ~your-urbit:dojo> &html &md '# hello'
193 '<html><head></head><body><div><h1 id="-hello">hello</h1></div></body></html>'
195#### `_` - Run a function
197Use `_` to run a gate (or function):
199 :: assign an arbitrary function and pass data to it
200 ~your-urbit:dojo> _|=({a/@} (mul a 3)) 3
203 :: use a function to get the status code from an http request
204 ~your-urbit:dojo> _|=({p/@ud q/* r/*} p) +http://google.com
208#### `+` `-` - HTTP requests
210`+http[s]://example.com` - sends a GET request
212`+http[s]://example.com &json [%s 'hi']` - sends a POST request with the
213JSON `"hi"` in the body.
215`-http[s]://example.com &json [%s 'hi']` - sends a PUT request with the
216JSON `"hi"` in the body.
218Note that the first of these is a source while the last two are sinks.
222Generators are simple hoon scripts loaded from the filesystem. They live
225Create a random moon (from any planet):
227 ~your-urbit:dojo> +moon
229 "moon: ~docsun-tamtem-your-urbit; ticket: ~bartug-hodbyr-fognum-ralmud"
233You can use `=` to set an environment variable in `:dojo`, but there are
234a few reserved names that have special uses.
238Current working `%clay` desk and revision. Read / write.
242 ~your-urbit:dojo> =dir %/web
243 ~your-urbit:dojo> +ls %
245 404/hoon docs/ dojo/hoon lib/ listen/hoon md static/md talk/ tree/main/
249Current set of libraries (`/lib`) in your environment. Can also be set
250with `/+`. Read / write.
254 ~your-urbit:dojo> =lib ~[[%react ~]]
255 ~your-urbit:dojo> :: this also works:
256 ~your-urbit:dojo> /+ react
257 ~your-urbit:dojo> :: now we can use arms from lib/react.hoon
258 ~your-urbit:dojo> (react-vale:react %div)
262Current set of structures (`/sur`) in your environment. Can also be set
263with `/-`. Read / write.
267 ~your-urbit:dojo> =sur ~[[%sole ~]]
268 ~your-urbit:dojo> :: this also works:
269 ~your-urbit:dojo> /- sole
270 ~your-urbit:dojo> :: now we can use arms in sur/sole.hoon
271 ~your-urbit:dojo> `sole-effect:sole`[%bel ~]
275The current (128-bit `@da`) time. Read-only.
279 ~your-urbit:dojo> now
281 ~2016.3.21..21.10.57..429a
285The current urbit plot. Read-only.
289 ~your-urbit:dojo> our
295256 bits of entropy. Read-only.
299 ~your-urbit:dojo> eny
301 0v1o.m2vio.j5ieb.7tq84.5kcnp.gjn04.9gl2e.tkj5v.0oqk3.iugk8.rhu6o
keysesc to close
- j k
- move down, up
- enter
- open
- esc
- back, or up a level
- 1 2 3 4
- readme, files, commits, refs
- /
- filter
- y
- copy the clone command
- c
- compare the chosen commit with another (or shift-click both)
- ?
- show or hide this list