Skip to content

Instantly share code, notes, and snippets.

@timmc
Created February 19, 2011 19:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save timmc/835284 to your computer and use it in GitHub Desktop.
Save timmc/835284 to your computer and use it in GitHub Desktop.
(defn pop-lax
"Pop the vector, but given an empty vector, simply return it."
[v]
(if (seq v) (pop v) []))
(def ^{:doc "Add a vertex to the last curve."}
append-vertex!
^{:actname "add vertex"}
(fn [^Point2D wp]
(dosync
(let [old-curves (.curves @udata)
front (pop-lax old-curves)
end (or (peek) [])]
(assoc-in-ref! udata [:curves]
(conj (conj end wp) front))))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment