@@ -27,6 +27,10 @@ Use `=var` to save a shell variable:
28 ~fintud-macrep:dojo> =foo (add 2 2)
28 ~fintud-macrep:dojo> =foo (add 2 2)
30+Use `=dir` to set the current working directory:
32+ ~fintud-macrep:dojo> =dir %/web
30Generators (files in `/gen`) are run with `+`:
34Generators (files in `/gen`) are run with `+`:
32 ~fintud-macrep:dojo> +hello 'world'
36 ~fintud-macrep:dojo> +hello 'world'
@@ -35,30 +39,169 @@ Save output to a file in `%clay` with `*`:
36 ~fintud-macrep:dojo> *foo/bar/hoon 'hello world'
40 ~fintud-macrep:dojo> *foo/bar/hoon 'hello world'
38−A system command to `:hood` using `|`:
42+Run system commands from `:hood`, like `reload`, using `|`:
40 ~fintud-macrep:dojo> |reload %eyre
44 ~fintud-macrep:dojo> |reload %eyre
46−# special vars
48+<h3 class="first child">Sources and sinks</h3>
50+A dojo command is either a source or a sink. A source is just something that can be printed to your console or the result of some computation. A sink is an *effect*: a change to the filesystem, a network message, a change to your environment, or typed message to an app.
52+Sources can be chained together, but we can only produce one effect per command.
56+### `=` - Set variable
58+Set any envronment variable:
60+ ~fintud-macrep:dojo> =foo 42
61+ ~fintud-macrep:dojo> (add 2 foo)
48−# command prefixes
63+ 44
50−### `:` send to app
65+(There are a few special variables that the dojo expects. See below.)
52−Send a poke message to `:square` as an `atom` mark:
67+### `:` - Send to app
54− ~fintud-macrep:dojo> :~fintud-macrep/square &atom (add 2 2)
69+ ~fintud-macrep:dojo> :hood &helm-hi 'hi'
71+### `*` - Save in `%clay`
73+ ~fintud-macrep:dojo> *%/web/foo/md '# hello'
56−### `.` download to Unix
75+### `.` - Download to Unix
58Download a noun to Unix with `.`:
77Download a noun to Unix with `.`:
60 ~fintud-macrep:dojo> .foo/bar/baz (add 2 2)
79 ~fintud-macrep:dojo> .foo/bar/baz (add 2 2)
62−# generators
81+### Sources
83+### `&` - Mark conversion
85+### `_` - Run a function
87+ _trip &html &md 'foo'
89+### `+` `-` - HTTP requests
91+ +http://google.com is get
92+ +http://google.com &json (joba %a ~) is post {a:null}
93+ -http://localhost:6000/foobar &json (joba %a ~) is put {a:null}
95+ +curl "http://google.com?q={(urle "my params")}"
96+ the trivial generator that sends a get request, the baseline on which you could write a scraper
100+### `[1 2 +hello 'world']` - Tuples
102+<h3 class="first child">Variables</h3>
104+You can use `=` to set an environment variable in `:dojo`, but there are a few reserved names that have special uses.
108+Current working `%clay` desk and revision. Read / write.
112+ ~fintud-macrep:dojo> =dir %/web
113+ ~fintud-macrep:dojo> +ls %
115+ 404/hoon docs/ dojo/hoon lib/ listen/hoon md static/md talk/ tree/main/
119+Current set of libraries (`/lib`) in your environment. Can also be set with `/+`. Read / write.
123+ ~fintud-macrep:dojo> =lib ~[[%react ~]]
124+ ~fintud-macrep:dojo> :: this also works:
125+ ~fintud-macrep:dojo> /+ react
126+ ~fintud-macrep:dojo> :: now we can use arms from lib/react.hoon
127+ ~fintud-macrep:dojo> (react-vale:react %div)
131+Current set of structures (`/sur`) in your environment. Can also be set with `/-`. Read / write.
135+ ~fintud-macrep:dojo> =sur ~[[%sole ~]]
136+ ~fintud-macrep:dojo> :: this also works:
137+ ~fintud-macrep:dojo> /- sole
138+ ~fintud-macrep:dojo> :: now we can use arms in sur/sole.hoon
139+ ~fintud-macrep:dojo> `sole-effect:sole`[%bel ~]
143+The current (128-bit `@da`) time. Read-only.
147+ ~fintud-macrep:dojo> now
149+ ~2016.3.21..21.10.57..429a
153+The current urbit plot. Read-only.
157+ ~fintud-macrep:dojo> our
163+256 bits of entropy. Read-only.
167+ ~fintud-macrep:dojo> eny
169+ 0v1o.m2vio.j5ieb.7tq84.5kcnp.gjn04.9gl2e.tkj5v.0oqk3.iugk8.rhu6o
175+#### `+curl` / `+curl-hiss`