aboutsummaryrefslogtreecommitdiffstats
path: root/miniscm/init.scm
diff options
context:
space:
mode:
authorGravatar Peter McGoron 2024-10-13 22:12:53 -0400
committerGravatar Peter McGoron 2024-10-13 22:12:53 -0400
commitca1b77d013ce2e14238e4f07c5831bb4cec1b614 (patch)
tree98c5899d3de420bf6d378699a87b00086a6a3280 /miniscm/init.scm
parentread.scm: more complete support for special numbers (diff)
miniscm: add notices and change "macro" to more standard "define-macro"HEADmaster
Diffstat (limited to 'miniscm/init.scm')
-rw-r--r--miniscm/init.scm55
1 files changed, 33 insertions, 22 deletions
diff --git a/miniscm/init.scm b/miniscm/init.scm
index 2427772..0cf7593 100644
--- a/miniscm/init.scm
+++ b/miniscm/init.scm
@@ -1,5 +1,17 @@
; This is a init file for Mini-Scheme.
-; Modified for UNSLISP.
+; Copyright (C) 2024 Peter McGoron
+;
+; This program is free software: you can redistribute it and/or modify
+; it under the terms of the GNU General Public License as published by
+; the Free Software Foundation, version 3 of the License.
+;
+; This program is distributed in the hope that it will be useful,
+; but WITHOUT ANY WARRANTY; without even the implied warranty of
+; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+; GNU General Public License for more details.
+;
+; You should have received a copy of the GNU General Public License
+; along with this program. If not, see <https://www.gnu.org/licenses/>.
(define modulo remainder)
@@ -146,11 +158,10 @@
(lambda args
(list->string args)))
-(macro
- cond-expand
- (lambda (body)
- (letrec
- ((loop
+(define-macro cond-expand
+ (lambda (body)
+ (letrec
+ ((loop
(lambda (body)
(if (null? body)
#f
@@ -159,24 +170,24 @@
((eqv? (car elem) 'else)
(cons 'begin (cdr elem)))
((and (pair? elem)
- (passes? (car elem)))
+ (passes? (car elem)))
(cons 'begin (cdr elem)))
(else (loop (cdr body))))))))
- (passes?
- (lambda (boolean-form)
- (cond
- ((eqv? boolean-form 'miniscm-unslisp) #t)
- ((eqv? boolean-form 'r3rs) #t)
- ((symbol? boolean-form) #f)
- ((not (pair? boolean-form)) (error "invalid boolean form"))
- ((eqv? (car boolean-form) 'and)
- (all passes? (cdr boolean-form)))
- ((eqv? (car boolean-form) 'or)
- (any passes? (cdr boolean-form)))
- ((eqv? (car boolean-form) 'not)
- (not (passes? (cadr boolean-form))))
- (else (error "invalid boolean function"))))))
- (loop (cdr body)))))
+ (passes?
+ (lambda (boolean-form)
+ (cond
+ ((eqv? boolean-form 'miniscm-unslisp) #t)
+ ((eqv? boolean-form 'r3rs) #t)
+ ((symbol? boolean-form) #f)
+ ((not (pair? boolean-form)) (error "invalid boolean form"))
+ ((eqv? (car boolean-form) 'and)
+ (all passes? (cdr boolean-form)))
+ ((eqv? (car boolean-form) 'or)
+ (any passes? (cdr boolean-form)))
+ ((eqv? (car boolean-form) 'not)
+ (not (passes? (cadr boolean-form))))
+ (else (error "invalid boolean function"))))))
+ (loop (cdr body)))))
(define (abs x)
(if (< x 0)