开发者

Scheme: Making a list of sublist maxes

开发者 https://www.devze.com 2023-01-23 19:49 出处:网络
Given a list, each item of which is an (r g b) color, return a list consisting of 开发者_高级运维the

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))
0

精彩评论

暂无评论...
验证码 换一张
取 消