chicken-users
[Top][All Lists]
Advanced

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

Re: [Chicken-users] two procedures looking for a good home


From: Alejandro Forero Cuervo
Subject: Re: [Chicken-users] two procedures looking for a good home
Date: Thu, 21 Feb 2008 12:30:34 -0800
User-agent: Mutt/1.5.13 (2006-08-11)

> (define (key-on proc #!optional (comparator <))
>   ;; Define a comparator function for a sort. E.g. to sort a list of
>   ;; lists by their first items, using string-case-insensitive
>   ;; comparison: (sort lst (key-on first string-ci<?))
>   (lambda (a b) (comparator (proc a) (proc b))))

This sounds very similar to the under-documented cmp-key function in
the orders egg:

> (define (cmp-key cmp key)
>   (lambda args (apply cmp (map key args))))

The orders egg provides some convenience wrappers around this.

Any help documenting that egg would be appreciated. :-)

Alejo.
http://azul.freaks-unidos.net/




reply via email to

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