From b9d0faf091c316d0811d73df9eea134dc23f8ed6 Mon Sep 17 00:00:00 2001
From: Maxime Devos <maximede...@telenet.be>
Date: Sun, 16 May 2021 20:32:34 +0200
Subject: [PATCH] =?UTF-8?q?Add=20=E2=80=98expt=E2=80=99=20to=20the=20list?=
 =?UTF-8?q?=20of=20effect-free=20primitives.?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

I find myself writing code like (- (expt 2 32) 1)
lately. Let's allow constant-folding that.

* module/language/tree-il/primitives.scm
  (*interesting-primitive-names*, *effect-free-primitives*):
  Add 'expt'.
---
 module/language/tree-il/primitives.scm | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/module/language/tree-il/primitives.scm b/module/language/tree-il/primitives.scm
index 1cc7907a8..7f3746b4f 100644
--- a/module/language/tree-il/primitives.scm
+++ b/module/language/tree-il/primitives.scm
@@ -48,6 +48,7 @@
     memq memv
     = < > <= >= zero? positive? negative?
     + * - / 1- 1+ quotient remainder modulo exact->inexact
+    expt
     ash logand logior logxor lognot logtest logbit?
     sqrt abs floor ceiling sin cos tan asin acos atan
     not
@@ -171,7 +172,7 @@
   `(values
     eq? eqv? equal?
     = < > <= >= zero? positive? negative?
-    ash logand logior logxor lognot logtest logbit?
+    expt ash logand logior logxor lognot logtest logbit?
     + * - / 1- 1+ sqrt abs quotient remainder modulo exact->inexact
     floor ceiling sin cos tan asin acos atan
     not
-- 
2.31.1

Attachment: signature.asc
Description: This is a digitally signed message part

Reply via email to