저는 multimethods를 사용하여 명령 줄 명령과 해당 인수를 구문 분석합니다. 나는 메타 데이터에 액세스하려고하면클로저에 멀티 메소드 메타 데이터를 설정하고 가져 오는 방법은 무엇입니까?
(defmulti run (fn [command args] command))
(defmethod run :default
[& _]
...)
^{:args "[command]"}
(defmethod run "help"
[_ & [args]]
"Display command list or help for a given command"
...)
^{:args ""}
(defmethod run "version"
[_ & [args]]
"Print program's version"
...)
(defn -main
[& args]
(run (first args)
(next args)))
은 특정 방법에 대한 Clojure의는 nil
반환
(meta ((methods run) "help"))