* Add ‘expt’ to the list of effect-free primitives
@ 2021-05-16 19:00 Maxime Devos
2021-05-18 17:25 ` lloda
0 siblings, 1 reply; 2+ messages in thread
From: Maxime Devos @ 2021-05-16 19:00 UTC (permalink / raw)
To: guile-devel
[-- Attachment #1.1: Type: text/plain, Size: 4 bytes --]
[-- Attachment #1.2: 0001-Add-expt-to-the-list-of-effect-free-primitives.patch --]
[-- Type: text/x-patch, Size: 1501 bytes --]
From b9d0faf091c316d0811d73df9eea134dc23f8ed6 Mon Sep 17 00:00:00 2001
From: Maxime Devos <maximedevos@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 #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 260 bytes --]
^ permalink raw reply related [flat|nested] 2+ messages in thread
end of thread, other threads:[~2021-05-18 17:25 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-16 19:00 Add ‘expt’ to the list of effect-free primitives Maxime Devos
2021-05-18 17:25 ` lloda
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).