on master help sign in
add reference documentation for gut:by (#788)
12a7e23Liam Fitzgerald
reference/library/2i.md+43
@@ -503,6 +503,49 @@ A noun.
503 ! exit
503 ! exit
504```
504```
505
505
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+
506---
549---
507### `+-has:by`
550### `+-has:by`
508
551