on master help sign in
added reserved words
911d8edHenry Ault
docs/programming/system/basic.md+18−1
@@ -113,7 +113,7 @@ more detail later.
113
113
114### How to form expressions
114### How to form expressions
115
115
116−Hoon does not use reserved words to form expressions. (We did recently implement an alternative keyword syntax, which is not covered here. For more information, see the [syntax section](/docs/programming/core/twig/syntax/). Instead,
116+Hoon does not typically use reserved words to form expressions. Instead,
117expressions are formed with runes--diagraphs of two
117expressions are formed with runes--diagraphs of two
118ascii symbols. Each rune takes a specific number of
118ascii symbols. Each rune takes a specific number of
119children--either expressions formed by other runes or literals
119children--either expressions formed by other runes or literals
@@ -153,6 +153,23 @@ See the entire naming schema below/or link to it:
153
153
154Using our naming scheme `?:` is said 'wut col'.
154Using our naming scheme `?:` is said 'wut col'.
155
155
156+For those that would prefer to use reserved words to form expressions, you can substitute a rune's keyword--which you can find in `++twig` in `/arvo/hoon.hoon`--for the rune. For example, here's the code for `?:` in `++twig`:
157+
158+`{$if p/twig q/twig r/twig} :: ?: if/then/else`
159+
160+Instead of:
161+
162+```
163+?:(=(1 2) 'this is true' 'this is false')
164+'this is false'`
165+```
166+You can write:
167+
168+```
169+if(=(1 2) 'this is true' 'this is false')
170+'this is false'
171+```
172+
156### Lines 12-34
173### Lines 12-34
157
174
158Now let's quickly walk through this code line-by-line. Lines
175Now let's quickly walk through this code line-by-line. Lines