This is the mail archive of the kawa@sources.redhat.com mailing list for the Kawa project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]