From dfe25e682d88514e2044cdf1ce5755f8a8c00c26 Mon Sep 17 00:00:00 2001 From: Stephen Adams Date: Tue, 23 Jul 1996 15:34:53 +0000 Subject: [PATCH] Added type:user-description, which gives an english description of the type for some simple types. --- v8/src/compiler/midend/types.scm | 25 ++++++++++++++++++++++--- 1 file changed, 22 insertions(+), 3 deletions(-) diff --git a/v8/src/compiler/midend/types.scm b/v8/src/compiler/midend/types.scm index 67c3878ad..b3a5ab1e7 100644 --- a/v8/src/compiler/midend/types.scm +++ b/v8/src/compiler/midend/types.scm @@ -1,8 +1,8 @@ #| -*-Scheme-*- -$Id: types.scm,v 1.3 1996/07/19 23:53:58 adams Exp $ +$Id: types.scm,v 1.4 1996/07/23 15:34:53 adams Exp $ -Copyright (c) 1995-1995 Massachusetts Institute of Technology +Copyright (c) 1995-1996 Massachusetts Institute of Technology This material was developed by the Scheme project at the Massachusetts Institute of Technology, Department of Electrical Engineering and @@ -83,6 +83,25 @@ MIT in each case. |# (else (loop type (cdr pairs) description))))) +(define (type:user-description type) + (define (try t name) + (and (type:subset? type t) name)) + (or (try type:boolean "a boolean") + (try type:exact-non-negative-integer "an exact non-negative integer") + (try type:exact-integer "an exact integer") + (try type:number "a number") + (try type:string "a string") + (try type:string "a character") + (try type:symbol "a symbol") + (try type:vector "a vector") + (try type:pair "a pair") + (try type:list "a list") + (try type:procedure "a procedure") + (if (type:subset? type:any type) + "an object" + (with-output-to-string + (lambda () (write (type:description type))))))) + (define type:empty (type:%make)) (define (make-primitive-type) @@ -266,7 +285,7 @@ MIT in each case. |# (define-type-name type:boolean 'BOOLEAN) (define-type-name (type:except type:fixnum type:fixnum>=0) 'NEGATIVE-FIXNUM) -(define-type-name type:fixnum 'FIXNUM?) +(define-type-name type:fixnum 'FIXNUM) (define-type-name type:exact-integer 'EXACT-INTEGER) (define-type-name type:exact-number 'EXACT-NUMBER) (define-type-name type:inexact-number 'INEXACT-NUMBER) -- 2.25.1