on master help sign in
roll and reel order of operations
e309820drbeefsupreme
content/docs/hoon/reference/stdlib/2b.md+24
@@ -625,6 +625,18 @@ We can fix this with `|:`:
62524
62524
626```
626```
627
627
628+If you check the definition of `+mul`, you'll see that it also utilizes this
629+pattern.
630+
631+We can check explicitly what sequence of operations `+reel` performs like this:
632+```
633+> =f |: [l='e_l' r='e_r']
634+ ^- @t
635+ :((cury cat 3) '(' l '*' r ')')
636+> =a "abcde"
637+> (reel a f)
638+'(a*(b*(c*(d*(e*e_r)))))'
639+```
628
640
629
641
630---
642---
@@ -699,6 +711,18 @@ We can fix this with `|:`:
699> (roll `(list @)`~[1 2 3 4] |:([a=1 b=1] (mul a b)))
711> (roll `(list @)`~[1 2 3 4] |:([a=1 b=1] (mul a b)))
70024
71224
701```
713```
714+If you check the definition of `+mul`, you'll see that it also utilizes this
715+pattern.
716+
717+We can check explicitly what sequence of operations `+roll` performs like this:
718+```
719+> =f |: [l='e_l' r='e_r']
720+ ^- @t
721+ :((cury cat 3) '(' l '*' r ')')
722+> =a "abcde"
723+> (roll a f)
724+'(e*(d*(c*(b*(a*e_r)))))
725+```
702
726
703
727
704---
728---