Skip to content

Instantly share code, notes, and snippets.

@cassiel
Created May 18, 2011 09:20
Show Gist options
  • Save cassiel/978270 to your computer and use it in GitHub Desktop.
Save cassiel/978270 to your computer and use it in GitHub Desktop.
first hack at the monome arc using clojure
; Our legacy Java OSC library:
(def transmitter (net.loadbang.osc.comms.UDPTransmitter. (java.net.InetAddress/getByName "localhost") 10332))
; Seriously non-idiomatic code. I'm only 20% of the way through the Joy of Clojure book...
(defn xmit [enc buffer]
"Transmit to encoder number enc, buffer is a sequence of integers."
(let [m (doto (net.loadbang.osc.data.Message. "/example/ring/map") (.addInteger enc))]
(doseq [n buffer] (.addInteger m n))
(.transmit transmitter m)
))
; There must be a better way to do this bit!
(def buf (map (fn [_] 5) (vec (range 64))))
(xmit 1 buf)
@samaaron
Copy link

:-) It seems to be Markdown which means you can either surround your code with backticks for inline code such as this

or you can indent by over four spaces

for something
that spans multiple
lines

@cassiel
Copy link
Author

cassiel commented May 18, 2011

The Markdown seems to be seriously on the blink...

@samaaron
Copy link

Here's how I formatted my previous comment:

:-) It seems to be Markdown which means you can either surround your code with backticks for inline code `such as this`

or you can indent by over four spaces

    for something
    that spans multiple
    lines

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment