From ce9bdb8b735f8311022f0407238548f6d0a96ba6 Mon Sep 17 00:00:00 2001 From: Joe Bryan Date: Fri, 2 Oct 2020 11:25:48 -0700 Subject: [PATCH] hoon: refactors +r-co:co, modernizing syntax --- pkg/arvo/sys/hoon.hoon | 29 +++++++++++++++-------------- 1 file changed, 15 insertions(+), 14 deletions(-) diff --git a/pkg/arvo/sys/hoon.hoon b/pkg/arvo/sys/hoon.hoon index 8a3e0c2c1..2a3a75af2 100644 --- a/pkg/arvo/sys/hoon.hoon +++ b/pkg/arvo/sys/hoon.hoon @@ -5992,20 +5992,21 @@ ++ c-co (em-co [58 1] |=({? b/@ c/tape} [~(c ne b) c])) ++ d-co |=(min/@ (em-co [10 min] |=({? b/@ c/tape} [~(d ne b) c]))) ++ r-co - |= a/dn - ?: ?=({$i *} a) (weld ?:(s.a "inf" "-inf") rep) - ?: ?=({$n *} a) (weld "nan" rep) - =+ ^= e %+ ed-co [10 1] - |= {a/? b/@ c/tape} - ?: a [~(d ne b) '.' c] - [~(d ne b) c] - =+ ^= f - =>(.(rep ~) (e a.a)) - =. e.a (sum:si e.a (sun:si (dec +.f))) - =+ b=?:((syn:si e.a) "e" "e-") - => .(rep ?~(e.a rep (weld b ((d-co 1) (abs:si e.a))))) - => .(rep (weld -.f rep)) - ?:(s.a rep ['-' rep]) + |= a=dn + ?: ?=([%i *] a) (weld ?:(s.a "inf" "-inf") rep) + ?: ?=([%n *] a) (weld "nan" rep) + =/ f=(pair tape @) + %. a.a + %+ ed-co(rep ~) [10 1] + |=([a=? b=@ c=tape] [~(d ne b) ?.(a c ['.' c])]) + =. e.a (sum:si e.a (sun:si (dec q.f))) + =/ res + %+ weld p.f + ?~ e.a + rep + %+ weld ?:((syn:si e.a) "e" "e-") + ((d-co 1) (abs:si e.a)) + ?:(s.a res ['-' res]) :: ++ s-co |= esc/(list @) ^- tape