From b18aa95de9f34ff8a9552f510a41f4f7106557f6 Mon Sep 17 00:00:00 2001 From: Alex Shelkovnykov Date: Tue, 5 Sep 2023 13:30:49 -0600 Subject: [PATCH] hoon: add +pow --- hoon/scaffolding/playpen.hoon | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/hoon/scaffolding/playpen.hoon b/hoon/scaffolding/playpen.hoon index 9eb17f5..472ea37 100644 --- a/hoon/scaffolding/playpen.hoon +++ b/hoon/scaffolding/playpen.hoon @@ -593,6 +593,17 @@ (dor a b) (lth c d) :: +:: Unsigned powers +:: +++ pow :: unsigned exponent + ~/ %pow + |= [a=@ b=@] + ?: =(b 0) 1 + |- ?: =(b 1) a + =+ c=$(b (div b 2)) + =+ d=(mul c c) + ?~ (dis b 1) d (mul d a) +:: :: Set logic :: ++ in