This is the mail archive of the
kawa@sources.redhat.com
mailing list for the Kawa project.
pair-map ?
- From: Chris Dean <Chris dot Dean at sokitomi dot com>
- To: Kawa List <kawa at sources dot redhat dot com>
- Date: Mon, 08 Sep 2003 23:00:45 -0700
- Subject: pair-map ?
Why isn't there a pair-map in SRFI-1? There is a pair-fold and
pair-for-each, but no pair-map. I have the feeling I'm missing
something obvious.
A simple pair-map could be implemented using pair-fold:
(define (pair-map f lis)
(reverse! (pair-fold (lambda (a b) (cons (f a) b)) '() lis)))
(pair-map (lambda (x) (format "|~A|" x)) '(a b c))
==> (|(a b c)| |(b c)| |(c)|)
Regards,
Chris Dean