Skip to content

Instantly share code, notes, and snippets.

@claybridges
Created December 12, 2014 18:21
Show Gist options
  • Save claybridges/4b787873a3efad4cfe3f to your computer and use it in GitHub Desktop.
Save claybridges/4b787873a3efad4cfe3f to your computer and use it in GitHub Desktop.
clojure example
(defn center-y-for-note
; arity = 2
([{:keys [origin size]} note]
(let [{:keys [height]} size]
(center-y-for-note (origin :y) (size :height) note)))
; arity = 3
([origin-y height note]
(let [note-increment (/ height 8)
ymin (+ origin-y height)]
(- ymin (* note-increment (notes/canonical-staff-position-for-note note))))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment