on master help sign in
adds Hoon lib entry for run:in
commit4e5c9fe81319071b34180dc47d08d93a76d248fb authorJoseph Bryan <joemfb@gmail.com> dateSun 26 Jun 2016, 23:34 (10 years ago) parent76bad7b
1 file changed+44
docs/hoon/library/2h.md+44
docs/hoon/library/2h.md+44
@@ -461,6 +461,50 @@ Examples
461461
462462------------------------------------------------------------------------
463463
464+### `+-run:in`
465+
466+Apply gate to set (often called *map*)
467+
468+Produce a `++set` containing the products of gate `b` applied to each element
469+in `a`.
470+
471+Accepts
472+-------
473+
474+`a` is a `++set`.
475+
476+`b` is a gate.
477+
478+Produces
479+--------
480+
481+A set.
482+
483+Source
484+------
485+
486+ +- run :: apply gate to values
487+ ~/ %run
488+ |* b/gate
489+ =| c/(set _?>(?=(^ a) (b n.a)))
490+ |- ?~ a c
491+ =. c (~(put in c) (b n.a))
492+ =. c $(a l.a, c c)
493+ $(a r.a, c c)
494+
495+
496+
497+Examples
498+--------
499+
500+ > =s (sy ~["a" "A" "b" "c"])
501+ > s
502+ {"A" "a" "c" "b"}
503+ > (~(run in s) cuss)
504+ {'A' 'C' 'B'}
505+
506+------------------------------------------------------------------------
507+
464508### `+-tap:in`
465509
466510Set to list