可能重复:
用常数映射序列
我正在尝试执行以下操作(只是一个示例):
(defn f [x param] (
; do something with "x" AND with "param"
))
(defn filtered-list [param] (map f ["a" "b" "c"]))
; called later as
(filtered-list 123)
; expected calls are: (f "a" 123), (f "b" 123) and (f "c" 123)
所以,我需要找到一种方法来传递param
给f
,被map
. 在 Clojure 中可以吗?这个特征也可以称为“功能闭包”。