on master help sign in
Fix /+ and /- docs: ship, case, and multi-arg
commit1edbbf58238d29d7ca1648c71ba6b5cd61504f75 authorTed Blackman <ted@tlon.io> dateFri 15 Sep 2017, 15:25 (9 years ago) parent105bd25
1 file changed+36−1
docs/arvo/internals/ford/runes.md+36−1
docs/arvo/internals/ford/runes.md+36−1
@@ -23,14 +23,45 @@ The `/+` rune accepts a filename as an argument. It interprets that filename as
2323a hoon source file within the `lib` directory. This is how we import a shared
2424library in urbit.
2525
26−Example:
26+To run this example, put this code in your desk at `gen/faslus.hoon` and run
27+`+faslus` in your dojo. This example is a generator. For more information on
28+generators, see the [generator docs](https://urbit.org/docs/arvo/generators).
2729
2830 /+ time-to-id
2931 ::
32+ :- %say
33+ |= {now/@da * *} $~ $~}
34+ :- %noun
3035 (time-to-id now)
3136
3237produces: `"c.314d"` (or something similar depending on when you run it)
3338
39+You can import multiple libraries with a single `/+` rune by separating them
40+with commas.
41+
42+Replace the code in `gen/faslus.hoon` with the following:
43+
44+ /+ time-to-id, hep-to-cab
45+ ::
46+ :- %say
47+ |= {{now/@da * *} $~ $~}
48+ :- %noun
49+ =/ id (time-to-id now)
50+ =/ str "my-id-is-{id}"
51+ (hep-to-cab (crip str))
52+
53+This should print something like `my_id_is_c.3588`.
54+
55+Another feature of the
56+`/+ and`/-`runes is the ability to specify the`ship`and`case\` from which to
57+load the library.
58+
59+Example:
60+
61+ /+ time-to-id, hep-to-cab/4/~zod
62+
63+will load the `hep-to-cab` library from `~zod` at `%clay` revision `4`.
64+
3465### `/-` import from sur/
3566
3667The `/-` rune accepts a filename as an argument. It interprets that filename as
@@ -46,6 +77,10 @@ Example:
4677
4778produces: `0v0`
4879
80+`/-` can also take multiple files as arguments, and the ship and case of those
81+arguments can be specified. See the `/+` docs for more details about the syntax
82+for those features.
83+
4984### `/~` twig by hand
5085
5186`/~ <twig>` produces a "horn" that evaluates a twig and places the product in