[r6rs-discuss] [Formal] Add (sort) and (vector-sort!) procedures

From: Eli Barzilay <eli>
Date: Mon Oct 2 18:26:09 2006

On Oct 3, Marcin 'Qrczak' Kowalczyk wrote:
> Eli Barzilay <eli_at_barzilay.org> writes:
>
> > (sort file-names
> > (lambda (f1 f2) (< (file-date f1) (file-date f2))))
> >
> > and
> >
> > (map cdr
> > (sort (map (lambda (f) (cons (file-date f) f)) file-names)
> > (lambda (p1) (< (car p1) (car p2)))))
> >
> > The scond version is doing half the number of FS accesses.
>
> Not half the number but 2*log(N) times less, where N is the number of
> elements to be sorted, assuming sorting takes N*log(N) comparisons.

(Yeah, sorry.)

-- 
          ((lambda (x) (x x)) (lambda (x) (x x)))          Eli Barzilay:
                  http://www.barzilay.org/                 Maze is Life!
Received on Mon Oct 02 2006 - 18:26:04 UTC

This archive was generated by hypermail 2.3.0 : Wed Oct 23 2024 - 09:15:01 UTC