From 87b82b5822ca54228cfa6df29be3ad9d4bc47d16 Mon Sep 17 00:00:00 2001 From: Bryan Newbold Date: Mon, 20 Feb 2017 00:05:28 -0800 Subject: Import Upstream version 2d2 --- obj2str.scm | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) (limited to 'obj2str.scm') diff --git a/obj2str.scm b/obj2str.scm index a8445f6..a9b8313 100644 --- a/obj2str.scm +++ b/obj2str.scm @@ -1,9 +1,9 @@ ;;; "obj2str.scm", write objects to a string. ;Copyright (C) 1993, 1994 Aubrey Jaffer ; -;Permission to copy this software, to redistribute it, and to use it -;for any purpose is granted, subject to the following restrictions and -;understandings. +;Permission to copy this software, to modify it, to redistribute it, +;to distribute modified versions, and to use it for any purpose is +;granted, subject to the following restrictions and understandings. ; ;1. Any copy made of this software must include this copyright notice ;in full. @@ -52,13 +52,12 @@ (generic-write obj #f #f (lambda (str) (let ((len (string-length str))) - (if (> len left) - (begin - (set! result (cons (substring str 0 left) result)) - (set! left 0) - #f) - (begin - (set! result (cons str result)) - (set! left (- left len)) - #t))))) + (cond ((> len left) + (set! result (cons (substring str 0 left) result)) + (set! left 0) + #f) + (else + (set! result (cons str result)) + (set! left (- left len)) + #t))))) (reverse-string-append result))) -- cgit v1.2.3