on master help sign in
Merge pull request #192 from urbit/ford-runes-fix

Fix /+ and /- docs: ship, case, and multi-arg

commitde4f62d227c187b6c729a495fbed9250088d3c3e authorKeaton Dunsford <keaton.dunsford@gmail.com> dateMon 16 Oct 2017, 14:03 (9 years ago) parentfc698e8b4643aa
1 file changed+42−1
docs/arvo/internals/ford/runes.md+42−1
docs/arvo/internals/ford/runes.md+42−1
@@ -12,14 +12,51 @@ The `/+` rune accepts a filename as an argument. It interprets that filename
1212as a hoon source file within the `lib` directory. This is how we import a shared
1313library in urbit.
1414
15−Example:
15+To run this example, put this code in your desk at `gen/faslus.hoon` and run
16+`+faslus` in your dojo. This example is a generator. For more information on
17+generators, see the [generator docs](https://urbit.org/docs/arvo/generators).
18+
1619```
1720/+ time-to-id
1821::
22+:- %say
23+|= {now/@da * *} $~ $~}
24+:- %noun
1925(time-to-id now)
2026```
27+
2128produces: `"c.314d"` (or something similar depending on when you run it)
2229
30+You can import multiple libraries with a single `/+` rune by separating them
31+with commas.
32+
33+Replace the code in `gen/faslus.hoon` with the following:
34+
35+```
36+/+ time-to-id, hep-to-cab
37+::
38+:- %say
39+|= {{now/@da * *} $~ $~}
40+:- %noun
41+=/ id (time-to-id now)
42+=/ str "my-id-is-{id}"
43+(hep-to-cab (crip str))
44+```
45+
46+This should print something like `my_id_is_c.3588`.
47+
48+Another feature of the
49+`/+ and`/-`runes is the ability to specify the`ship`and`case\` from which to
50+load the library.
51+
52+Example:
53+
54+```
55+/+ time-to-id, hep-to-cab/4/~zod
56+```
57+
58+will load the `hep-to-cab` library from `~zod` at `%clay` revision `4`.
59+
2360### `/-` import from sur/
2461
2562The `/-` rune accepts a filename as an argument. It interprets that filename as
@@ -35,6 +72,10 @@ Example:
3572```
3673produces: `0v0`
3774
75+`/-` can also take multiple files as arguments, and the ship and case of those
76+arguments can be specified. See the `/+` docs for more details about the syntax
77+for those features.
78+
3879### `/~` twig by hand
3980
4081`/~ <twig>` produces a "horn" that evaluates a twig and places the product in