mit-scheme-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [MIT-Scheme-devel] SUBSTRING and SET-STRING-MAXIMUM-LENGTH!


From: Taylor R Campbell
Subject: Re: [MIT-Scheme-devel] SUBSTRING and SET-STRING-MAXIMUM-LENGTH!
Date: Sun, 6 Sep 2009 01:03:19 -0400
User-agent: IMAIL/1.21; Edwin/3.116; MIT-Scheme/7.7.90.+

   Date: Sat, 5 Sep 2009 21:50:24 -0700
   From: Joe Marshall <address@hidden>

   I just pushed a change that restored everything to the way it was.
   I'll try to figure out a way to implement string-head! that is portable.

Why do we need something portable?  What's wrong with this?

(define (string-head! string end)
  (guarantee-string string 'STRING-HEAD!)
  (guarantee-substring-end-index end
                                 (string-maximum-length string)
                                 'STRING-HEAD!)
  (set-string-maximum-length! string end)
  ;; SET-STRING-MAXIMUM-LENGTH! has no effect in some implementations
  ;; of the microcode.  If so, just copy the head.
  (if (fix:= end (string-maximum-length string))
      string
      (%substring string 0 end)))




reply via email to

[Prev in Thread] Current Thread [Next in Thread]