shithub: femtolisp

Download patch

ref: 6e1de7777b33d03b7baa34317fa9d2153cbf22d0
parent: 63558a798d4b3a1833f097a9b8d8c27e28402463
author: Sigrid Solveig Haflínudóttir <sigrid@ftrv.se>
date: Wed Nov 27 07:35:29 EST 2024

pow -> expt

--- a/builtins.c
+++ b/builtins.c
@@ -470,4 +470,4 @@
 		return mk_double(cname(todouble(args[0]), todouble(args[1]))); \
 	}
 
-BUILTIN_("pow", pow)
+BUILTIN_("expt", pow)
--- a/test/test.lsp
+++ b/test/test.lsp
@@ -61,19 +61,6 @@
 (define-macro (labl name fn)
   `((λ (,name) (set! ,name ,fn)) ()))
 
-(define (square x) (* x x))
-(define (expt b p)
-  (cond ((= p 0) 1)
-        ((= b 0) 0)
-        ((even? p) (square (expt b (div0 p 2))))
-        (#t (* b (expt b (- p 1))))))
-
-(define (gcd a b)
-  (cond ((= a 0) b)
-        ((= b 0) a)
-        ((< a b)  (gcd a (- b a)))
-        (#t       (gcd b (- a b)))))
-
 ; like eval-when-compile
 (define-macro (literal expr)
   (let ((v (eval expr)))