annotate src/clojureDemo/WiredDemo.clj @ 11:f952052e37b7

trying a fix.
author Robert McIntyre <rlm@mit.edu>
date Tue, 24 Aug 2010 19:06:45 -0400
parents 6d9bdaf919f7
children
rev   line source
rlm@1 1 (ns clojureDemo.WiredDemo
rlm@1 2 (
rlm@1 3 :gen-class
rlm@1 4 :implements [connections.WiredBox]
rlm@1 5 :methods [ [process [Object] void]]
rlm@1 6 :post-init register
rlm@1 7 )
rlm@1 8 )
rlm@1 9
rlm@1 10
rlm@1 11 (defn -register [this]
rlm@1 12
rlm@1 13 ; translate:
rlm@1 14 ; Connections.getPorts(this).addSignalProcessor("process");
rlm@1 15 ; ---- to -----
rlm@1 16
rlm@1 17 (println "ClojureBox (register) : Register is run only when the object is created, like a constructor.")
rlm@1 18
rlm@1 19 (. (connections.Connections/getPorts this) addSignalProcessor "process")
rlm@1 20
rlm@1 21
rlm@1 22 )
rlm@1 23
rlm@1 24
rlm@1 25 (defn -process [ _ _ ]
rlm@1 26 (println "ClojureBox (process) : This is a LISP function, being called through Java, through the wiredBox metaphor.")
rlm@1 27 )
rlm@1 28
rlm@1 29
rlm@1 30
rlm@1 31
rlm@1 32 (
rlm@1 33 defn -getName [_] "ClojureBox"
rlm@1 34
rlm@1 35 ; the [_] means that the function gets an explicit "this" argument, like python,
rlm@1 36 ; but we don't care about it.
rlm@1 37
rlm@1 38 )
rlm@1 39
rlm@1 40