From 6ff973369abcbf3202f60b65885cd5a3382f20f7 Mon Sep 17 00:00:00 2001 From: Chris Hanson Date: Tue, 8 Feb 2005 00:11:11 +0000 Subject: [PATCH] Implement GUARANTEE-STREAM-PAIR. --- v7/src/runtime/runtime.pkg | 4 +++- v7/src/runtime/stream.scm | 14 +++++++------- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/v7/src/runtime/runtime.pkg b/v7/src/runtime/runtime.pkg index f12501888..53d1873ad 100644 --- a/v7/src/runtime/runtime.pkg +++ b/v7/src/runtime/runtime.pkg @@ -1,6 +1,6 @@ #| -*-Scheme-*- -$Id: runtime.pkg,v 14.529 2005/01/23 17:53:16 cph Exp $ +$Id: runtime.pkg,v 14.530 2005/02/08 00:10:55 cph Exp $ Copyright 1988,1989,1990,1991,1992,1993 Massachusetts Institute of Technology Copyright 1994,1995,1996,1997,1998,1999 Massachusetts Institute of Technology @@ -3821,6 +3821,8 @@ USA. (export () condition-type:illegal-stream-element empty-stream? + error:not-stream-pair + guarantee-stream-pair head list->stream make-prime-numbers-stream diff --git a/v7/src/runtime/stream.scm b/v7/src/runtime/stream.scm index 440339ddc..b9b706193 100644 --- a/v7/src/runtime/stream.scm +++ b/v7/src/runtime/stream.scm @@ -1,9 +1,9 @@ #| -*-Scheme-*- -$Id: stream.scm,v 14.19 2004/06/12 02:15:48 cph Exp $ +$Id: stream.scm,v 14.20 2005/02/08 00:11:11 cph Exp $ Copyright 1986,1987,1988,1989,1992,1995 Massachusetts Institute of Technology -Copyright 1998,2003,2004 Massachusetts Institute of Technology +Copyright 1998,2003,2004,2005 Massachusetts Institute of Technology This file is part of MIT/GNU Scheme. @@ -33,14 +33,14 @@ USA. (and (pair? stream) (promise? (cdr stream)))) +(define-guarantee stream-pair "stream pair") + (define (stream-car stream) - (if (not (stream-pair? stream)) - (error:wrong-type-argument stream "stream" 'STREAM-CAR)) + (guarantee-stream-pair stream 'STREAM-CAR) (car stream)) (define (stream-cdr stream) - (if (not (stream-pair? stream)) - (error:wrong-type-argument stream "stream" 'STREAM-CDR)) + (guarantee-stream-pair stream 'STREAM-CDR) (force (cdr stream))) (define the-empty-stream '()) @@ -247,7 +247,7 @@ USA. (cons-stream (car list) (list->stream (cdr list))) (begin (if (not (null? list)) - (error:wrong-type-argument list "list" 'LIST->STREAM)) + (error:not-list list 'LIST->STREAM)) '()))) (define (stream->list stream) -- 2.25.1