Scheme: Making a list of sublist maxes
Given a list, each item of which is an (r g b) color, return a list consisting of 开发者_高级运维the maximum component in each color.
Example: given ((123 200 6) (10 30 20) (212 255 10) (0 0 39) (37 34 34)), code should return (200 30 255 39 37)
(define (sublist-max list-of-lists)
(map (lambda (sublist) (apply max sublist)) list-of-lists))
精彩评论