add reference documentation for gut:by (#788)
* add reference documentation for gut:by
* fix typo
commit12a7e23a5e267713eff8603f983f6f8cec9cdce5
authorLiam Fitzgerald <46801558+liam-fitzgerald@users.noreply.github.com>
dateThu 6 Feb 2020, 06:02 (7 years ago)
parentf6b65e3
reference/library/2i.md+43
@@ -503,6 +503,49 @@ A noun.
503503 ! exit
504504```
505505
506+---
507+### `+-gut:by`
508+
509+Grab value with default
510+
511+Produce the value located at key `b` within map `a`. Use default value `c` if
512+key does not exist.
513+
514+#### Accepts
515+
516+`a` is a map.
517+
518+`b` is a key as a noun.
519+
520+`c` is a noun.
521+
522+#### Produces
523+
524+A noun.
525+
526+#### Source
527+
528+```hoon
529+ ++ gut :: fall value by key
530+ |* [b=* c=*]
531+ (fall (get b) c)
532+
533+```
534+
535+#### Examples
536+
537+```
538+ > =m (my [['a' 1] ['b' 2] ~])
539+ > m
540+ [n=[p='b' q=2] l={[p='a' q=1]} r={}]
541+
542+ > (~(gut by m) 'a' 0)
543+ 1
544+
545+ > (~(gut by m) 'c' 0)
546+ 0
547+```
548+
506549---
507550### `+-has:by`
508551