I suggest starting with EDWIN-SET-STRING-MAXIMUM-LENGTH! in
"edwin/utils.scm".  That solution should be faster in compiled code.
If you look in that file a little further down, you'll see that it's
only used when compiled.

Some variation of this hackery should provide a reasonable solution.

On Sat, Sep 5, 2009 at 10:03 PM, Taylor R Campbell<[email protected]> wrote:
>   Date: Sat, 5 Sep 2009 21:50:24 -0700
>   From: Joe Marshall <[email protected]>
>
>   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)))
>


_______________________________________________
MIT-Scheme-devel mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/mit-scheme-devel

Reply via email to