Hi Jay
Yes, draw and update functions support live coding out-of-box. It's trickier with middleware. The main thing is that middleware run once, when initializing sketch. The goal of middleware is to take user provided settings (like draw and update funcitons), optionally wrap some of them in another functions and return new settings. It depends on your middleware implementation whether it supports live coding. As a simple example let's say you have a simple middleware that fills background with some color before each draw. Here is how you can do it so it supports live reloading:
(defn fill-background [draw-fn]
(q/background 255)
(draw-fn))
(defn fill-background-middleware [options]
(let [user-draw (:draw options)]
(assoc options
:draw #(fill-background user-draw))))
(q/defsketch abc
:draw ...
:middleware [fill-background-middleware])
If you try changing 'fill-background', for example change color from 255 to 200, then you should see effect immediately. The trick is on line
:draw #(fill-background user-draw))))
Here we say that new draw function is an anonymous function that calls fill-background. So on each draw invocation it will lookup fill-background function by name. If you reload this function - name will stay the same, but implementation changes and interpreter pick ups new function. On the other hand if you do following:
:draw (partial fill-background user-draw)
Then you won't get live reloading. Even though these 2 approaches essentially do the same, the second approach actually "remembers" original version of fill-background. If you try changing that function it won't have effect as interpreter no longer looks up function by name.
I'm probably not explaining it very well but I hope it's still helpful. If you still have problems with your middleware - feel free to post the code in this thread and I'll take a look.
Nikita