0

I am trying to pass a list of arguments to the polygon function:

(polygon [1 2] [3 4] [5 6])

(polygon pairs) ;;Throws exception

where pairs:

clojure.lang.LazySeq  ([2.2935636 48.8580886] [2.2933061 48.8582457] [2.2935366 48.8584053] [2.2935553 48.8583952] ...)

Passing the LazySeq gives clojure.lang.LazySeq cannot be cast to java.lang.Number

I am making pairs using this function

(def pairs  (map vector  poly-x  poly-y))

How do I unwrap this vector so the compiler treat will the passed argument separately

polygon signature:

(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])
T.Gounelle
  • 5,953
  • 1
  • 22
  • 32
raam86
  • 6,785
  • 2
  • 31
  • 46

1 Answers1

1

Of course apply was the way to go:

(apply polygon pairs)
raam86
  • 6,785
  • 2
  • 31
  • 46