을 적용하는 방법을 순서에 기능의 시퀀스의 변수에서 Clojure?

0

질문

나는 기능이 소요되는 시퀀스의 기능 및 순서의 인수입니다. 이를 반환해야 합 벡터의 결과 각 기능에 적용되는 시퀀스의 인수입니다.

((solution + max min) 2 3 5 1 6 4) ;;--> [21 6 1]

Im 를 해결하기 위해 노력하고 함께 줄지 몰라요 적용하는 방법 모든 기능을 작동만을 위한 첫 번째 기능:

(defn solution
  [& args]
 (fn [& args2]
 (reduce (first args) [] args2)))
clojure higher-order-functions
2021-11-13 20:27:42
1

최고의 응답

4

juxt:

((juxt + max min) 2 3 5 1 6 4)
=> [21 6 1]

나 정의하는 기능 solution:

(defn solution
  [& args]
  (fn [& args2]
    (apply (apply juxt args) args2)))

((solution + max min) 2 3 5 1 6 4)
=> [21 6 1]
2021-11-13 20:34:59

론, (def solution juxt) 것을 정의할 solution.
jaihindhreddy

다른 언어로

이 페이지는 다른 언어로되어 있습니다

Русский
..................................................................................................................
Italiano
..................................................................................................................
Polski
..................................................................................................................
Română
..................................................................................................................
हिन्दी
..................................................................................................................
Français
..................................................................................................................
Türk
..................................................................................................................
Česk
..................................................................................................................
Português
..................................................................................................................
ไทย
..................................................................................................................
中文
..................................................................................................................
Español
..................................................................................................................
Slovenský
..................................................................................................................