on master help sign in
Fix wrong docs about % and /_; add docs for /:
bc19193Ted Blackman
docs/arvo/internals/ford/runes.md+26−16
@@ -30,7 +30,7 @@ Example:
30```
30```
31// %/file-to-include
31// %/file-to-include
32::
32::
33−(frobnicate:file-to-include |)
33+(frobnicate:file-to-include %.n)
34
34
35:: contents of file-to-include.hoon
35:: contents of file-to-include.hoon
36|%
36|%
@@ -45,9 +45,7 @@ _Note: `%` means current directory, which in a hoon file will resolve to the
45"directory" containing that file. Also, %clay doesn't have first-class
45"directory" containing that file. Also, %clay doesn't have first-class
46directories the way unix filesystems do. Whereas in unix, a directory is a
46directories the way unix filesystems do. Whereas in unix, a directory is a
47special kind of file, in %clay it's just a path prefix, and there is no file
47special kind of file, in %clay it's just a path prefix, and there is no file
48−stored at that path. The meaning of `%` is also contextual: some ford runes can
48+stored at that path._
49−also modify the value of `%` inside their arguments (see the docs for `/_` for
50−an example)._
51
49
52### `/=` wrap a face around an included horn
50### `/=` wrap a face around an included horn
53
51
@@ -63,21 +61,33 @@ produces: `[0 1]`
63
61
64### `/_` run a horn on each file in the current directory
62### `/_` run a horn on each file in the current directory
65
63
66−`/_` takes a horn as an argument. It produces a new horn
64+`/_` takes a horn as an argument. It produces a new horn representing the
67−representing the result of mapping the supplied horn over
65+result of mapping the supplied horn over the list of files in the current
68−the list of files in the current directory.
66+directory. The keys in the resulting map are the basenames of the files in the
67+directory, and each value is the result of running that horn on the contents of
68+the file.
69
69
70Example:
70Example:
71```
71```
72−/= kids /_ /~ %
72+/= kids /_ /hoon/
73−`(map term path)`kids
73+`(map term cord)`kids
74```
74```
75
75
76−produces a value of type `(map term path)`, where each key is the basename (the
76+produces a value of type `(map term cord)`, where each key is the basename (the
77−filename without the prefix), and each value is the prefix: the path of the
77+filename without the prefix), and each value is the result of running the
78−"directory" containing that file.
78+contents of the file through the `%hoon` mark, which validates that it's valid
79+hoon code and returns it unmodified. So, the resulting map associates basenames
80+with file contents. For more information on marks, see the docs for the
81+`/<mark>/` syntax.
79
82
80−_Note that `%` is contextual: it takes on different values based on the
83+### `/:` evaluate at path
81−"current directory", which can be set by `/_` and other ford runes. For each
84+
82−file in the directory through which `/_` is iterating, `%` becomes the path of
85+`/:` takes a path and a horn, and evaluates the horn with the current path set to the supplied path.
83−that file during that iteration._
86+
87+Example:
88+```
89+/= hoo-source /: /path/to/hoon-file /hoon/
90+`@t`hoo-source
91+```
92+
93+produces the text of the hoon file at "/path/to/hoon-file/hoon".