【问题标题】:Scheme: Making a list of sublist maxes方案:制作子列表最大值列表
【发布时间】:2010-11-03 03:18:28
【问题描述】:

给定一个列表,其中每一项都是 (r g b) 颜色,返回一个由 每种颜色的最大分量。

示例:给定 ((123 200 6) (10 30 20) (212 255 10) (0 0 39) (37 34 34)), 代码应该返回 (200 30 255 39 37)

【问题讨论】:

  • 另外,应该使用filter,map,accumulate来完成

标签: list scheme max sublist


【解决方案1】:
(define (sublist-max list-of-lists)
    (map (lambda (sublist) (apply max sublist)) list-of-lists))

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2016-09-04
    • 2016-12-03
    • 2023-01-02
    • 1970-01-01
    • 2020-03-04
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多