From 259974da047713d999740fac353b1188a1c03e05 Mon Sep 17 00:00:00 2001 From: Chris Hanson Date: Wed, 1 Jan 2003 05:38:34 +0000 Subject: [PATCH] Add predicate and guarantee for exact positive integers. --- v7/src/runtime/arith.scm | 17 ++++++++++++----- v7/src/runtime/runtime.pkg | 9 +++++++-- 2 files changed, 19 insertions(+), 7 deletions(-) diff --git a/v7/src/runtime/arith.scm b/v7/src/runtime/arith.scm index f9fb625f1..f4622cad8 100644 --- a/v7/src/runtime/arith.scm +++ b/v7/src/runtime/arith.scm @@ -1,8 +1,10 @@ #| -*-Scheme-*- -$Id: arith.scm,v 1.52 2003/01/01 02:35:50 cph Exp $ +$Id: arith.scm,v 1.53 2003/01/01 05:38:22 cph Exp $ -Copyright (c) 1989-1999, 2001, 2002 Massachusetts Institute of Technology +Copyright (c) 1989,1990,1991,1992,1993 Massachusetts Institute of Technology +Copyright (c) 1994,1995,1996,1997,1999 Massachusetts Institute of Technology +Copyright (c) 2001,2002,2003 Massachusetts Institute of Technology This file is part of MIT Scheme. @@ -1780,12 +1782,16 @@ Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. (define exact-rational? rat:rational?) (define exact-integer? int:integer?) +(define (inexact? z) + (not (complex:exact? z))) + (define (exact-nonnegative-integer? object) (and (int:integer? object) (not (int:negative? object)))) -(define (inexact? z) - (not (complex:exact? z))) +(define (exact-positive-integer? object) + (and (int:integer? object) + (int:positive? object))) (let-syntax ((define-guarantee @@ -1806,8 +1812,9 @@ Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. (define-guarantee exact "exact number") (define-guarantee exact-rational "exact rational number") (define-guarantee exact-integer "exact integer") + (define-guarantee inexact "inexact number") (define-guarantee exact-nonnegative-integer "exact non-negative integer") - (define-guarantee inexact "inexact number")) + (define-guarantee exact-positive-integer "exact positive integer")) ;; Replaced with arity-dispatched version in INITIALIZE-PACKAGE! diff --git a/v7/src/runtime/runtime.pkg b/v7/src/runtime/runtime.pkg index 3b6c60924..0b459ae8b 100644 --- a/v7/src/runtime/runtime.pkg +++ b/v7/src/runtime/runtime.pkg @@ -1,8 +1,11 @@ #| -*-Scheme-*- -$Id: runtime.pkg,v 14.418 2003/01/01 02:36:10 cph Exp $ +$Id: runtime.pkg,v 14.419 2003/01/01 05:38:34 cph Exp $ -Copyright (c) 1988-2002 Massachusetts Institute of Technology +Copyright (c) 1988,1989,1990,1991,1992 Massachusetts Institute of Technology +Copyright (c) 1993,1994,1995,1996,1997 Massachusetts Institute of Technology +Copyright (c) 1998,1999,2000,2001,2002 Massachusetts Institute of Technology +Copyright (c) 2003 Massachusetts Institute of Technology This file is part of MIT Scheme. @@ -2210,6 +2213,7 @@ Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. exact->inexact exact-integer? exact-nonnegative-integer? + exact-positive-integer? exact-rational? exact? exp @@ -2225,6 +2229,7 @@ Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. guarantee-exact guarantee-exact-integer guarantee-exact-nonnegative-integer + guarantee-exact-positive-integer guarantee-exact-rational guarantee-inexact guarantee-integer -- 2.25.1