Mercurial > lasercutter
view src/clojureDemo/WiredDemo.clj @ 10:ef7dbbd6452c
added clojure source goodness
author | Robert McIntyre <rlm@mit.edu> |
---|---|
date | Sat, 21 Aug 2010 06:25:44 -0400 |
parents | 6d9bdaf919f7 |
children |
line wrap: on
line source
1 (ns clojureDemo.WiredDemo2 (3 :gen-class4 :implements [connections.WiredBox]5 :methods [ [process [Object] void]]6 :post-init register7 )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 )