view src/clojureDemo/WiredDemo.clj @ 4:6533b4ef83ad

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