on master help sign in
roll and reel order of operations
commite309820dc72ec7564e2dbc21ef6827c01daf1175 authordrbeefsupreme <drbeefsupreme@discordja.net> dateThu 16 Sep 2021, 14:22 (5 years ago) parentc926eff
1 file changed+24
content/docs/hoon/reference/stdlib/2b.md+24
content/docs/hoon/reference/stdlib/2b.md+24
@@ -625,6 +625,18 @@ We can fix this with `|:`:
62562524
626626```
627627
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+```
628640
629641
630642---
@@ -699,6 +711,18 @@ We can fix this with `|:`:
699711> (roll `(list @)`~[1 2 3 4] |:([a=1 b=1] (mul a b)))
70071224
701713```
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+```
702726
703727
704728---