Created
February 19, 2011 19:12
-
-
Save timmc/835284 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(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