> (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/ _______________________________________________ Chicken-users mailing list Chicken-users@nongnu.org http://lists.nongnu.org/mailman/listinfo/chicken-users