我正试图将参数列表传递给polygon
函数:
(polygon [1 2] [3 4] [5 6])
(polygon pairs) ;;Throws exception
其中对:
clojure.lang.LazySeq ([2.2935636 48.8580886] [2.2933061 48.8582457] [2.2935366 48.8584053] [2.2935553 48.8583952] ...)
通过LazySeq得到clojure.lang.LazySeq cannot be cast to java.lang.Number
我正在使用这个功能配对
(def pairs (map vector poly-x poly-y))
我如何打开这个向量,以便编译器单独处理传递的参数
多边形签名:
(defn polygon
"Create a polygonal shape with the given set of vertices.
points is a list of x/y pairs, e.g.:
(polygon [1 2] [3 4] [5 6])
"
[& points])
当然,应用是要走的路:
(apply polygon pairs)