I apologize that I'm new to Clojure. I've found there's not much in the way of tooling or tutorials for the Clojure world that I've been able to digest so far, so I've downloaded Light Table ( http://www.lighttable.com/ ) which sounds like it should make it easier. I'm on Windows 7 64-bit and the basic Light Table UI seems to be working.
To try to experiment further with Light Table / Clojure, I've also downloaded Clojure drawing library Quil ( https://github.com/quil/quil ), but after instructing Light Table to connect to \quil-master\project.clj and then opening and executing various files from \quil-master\examples (such as automata.clj or graphics.clj), Light Table produces what I assume is a spinning blue "thinking" icon that gets stuck or eventually ends with "nil" or "java.lang.Math".
Only "example2.clj" seems to work (although not always) in that it (usually) pops up a window with a color-changing diamond. What do I need to do to make these other Quil examples work in Light Table?
(On a side note, I've also downloaded Mire (another Clojure project on Github), but it also won't run at all with Light Table.)
This answer was for LightTable 0.2.0. I have not yet tried the new 0.3.0.
It makes perfect sense to try and pick LightTable and Quil. I think the pain is mostly due to a chicken and egg problem.
If you are connecting to quil as a project, opening example2.clj and executing it (Ctrl Shift Enter) and getting a light blue "nil" - Congratulations you have a working system! (At least I can duplicate the exact same behavior and the example seems to work).
The first time you do this it may take a while for LightTable to download all of Quil's dependencies (maybe why LightTable appeared to hang - or maybe Light Table and Quil have an interaction bug I have yet to trigger.)
That "nil" is the return value resulting from Light Table executing the file (in the context of the running project) (see footnote). Somewhere (perhaps hidden behind a full screen Light Table) a new window should be created with the example running.
The "java.lang.Math" value of executing automata.clj is also consistent with what I see.
Here the trick is to generate a call to defsketch
which example2.clj did inline but automata.clj does not.
You can create the sketch by calling the function run-rule
:
After executing the file automata.clj (to get all the function definitions loaded) add the following line to the end of the file in the editor:
(run-rule 101 {:width 100 :height 100 :scale 4})
Put the cursor after the closing paren and execute the single form with Ctrl-Enter. Again a new window (possibly hidden behind some other window - try task switching with Alt-Tab) should open running the automata demo.
With Light Table connected to the quil project and automata.clj already evaluated you can also get the same effect by opening an "instarepl" and typing:
(clj-automata.core/run-rule 101
{:width 100 :height 100
:scale 4})
Try editing the values and seeing what happens. (Again the whole nature of Quil being side-effecting makes this not quite so elegant in LightTable but it seems to work.)
Footnote:
I am not very familiar with LightTable. I would have expected the light blue to be the result of evaluating the last form in the file but this seems to not to be the case. Using Cntl-Enter on the last line reveals "#'example2/example2" not "nil".
I am also not very familiar with Quil and defsketch
is macro not a regular function so maybe that is interacting in an odd way with LightTable.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With