小编due*_*ers的帖子

是否有更好的方法来映射除第一项之外的所有项目?

我觉得必须有一个更清洁的方法来做到这一点,但我没有看到它.

(defn map-rest
  "Passes through the first item in coll intact. Maps the rest with f."
  [f coll]
  (concat (list (first coll)) (map f (rest coll))))
Run Code Online (Sandbox Code Playgroud)

clojure

11
推荐指数
1
解决办法
245
查看次数

标签 统计

clojure ×1