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

Re: Memory use of sort!

This page is part of the web mail archives of SRFI 95 from before July 7th, 2015. The new archives for SRFI 95 contain all messages, not just those from before July 7th, 2015.

 | Date: Tue, 07 Nov 2006 13:52:04 +0100
 | From: =?ISO-8859-1?Q?Jens_Axel_S=F8gaard?= <jensaxel@soegaard.net>
 | The specification of sort! reads:
 |    Function: sort! sequence less?
 |    Function: sort! sequence less? key
 |        Returns list, array, vector, or string sequence which has
 |    been mutated to order its elements according to less?. Given
 |    valid arguments, it is always the case that:
 |        (sorted? (sort! sequence less?) less?) => #t
 | Would be possible to add that the sorting is in-place?  That is
 | guarantee, that no (or very little) extra memory is allocated
 | during the sorting process.

I originally had language to limit allocation of pairs, but it
required all sorts of caveats about the stack and other potential uses
of pairs.  I find no such language in R5RS; does any SRFI limit pair

As W. Clinger points out, some things must be left to the