1. 16

After seeing https://www.creativeapplications.net/tutorials/introduction-to-clojure-part-1/ on this site and discovering Quil (http://www.quil.info/) I wanted to ask you guys if you have any experience to share with your usage of Clojure for generative art.

I’m especially interested in your setup. Is there a way to quickly iterate on a sketch/program by letting Clojure reevaluate it?

  1. 6

    Unfortunately I don’t use Clojure. My setup for generative “art”* is Rust and Cairo. I recently tried using Python and Cairo and found it a lot easier to work because it was more forgiving.

    Tyler Hobs talks about using Quil for artwork here, and Ben Kovach mentions some things about infrastructure and tooling for generative art that you might find interesting.

    Quil looks really cool so I might try that out next :)

    * I’m putting quotes around art because I don’t think what I make is art. I just have fun by writing simple programs and adding some randomness. There’s not a lot of purpose or emotion behind what I do, since a lot of it is for learning rust.

    1. 2

      Do you have any examples to share? I’m interested in generative art but never really have the gumption-time to do it.

    2. 4

      Clojure is great for this. Quil + figwheel is the way to go.

      I do a lot of development (not just toys, but also toys) using emacs cider-mode with figwheel, it’s another layer on top of Quil/Figwheel which is another layer on top of Clojure which is another layer on top of, in this case, JavaScript. (Meaning it’s a pretty big bite, since you need some familiarity all the way through the stack.)

      Cider provides a lot of nice features, it’s perfectly suitable for live-coding. Cider can be a little fickle (especially against the new version of figwheel, figwheel-main), but if you want to itterate really fast theres no comparison. If you’re starting out, I strongly recommend the leiningen figwheel template and an editor you’re familiar with before going down that road (but, you should go down that road.)

      1. 3

        I’ve had good experiences using clojurescript and figwheel to do hot reloading on file change. Quil is compatible with clojurescript

        1. 2

          I’d second this. Maybe also devcards. But this setup makes it really easy to write some code, save and see the changes right away as it re-renders. Even if your desired target isn’t the web, the same Quil code should then work in eg. OpenGL as well.

        2. 2

          I’d be really interested in whether there’s a similar thing for diagrams & schematics - still generated by code, but less art and more illustration / explanatory diagrams.

          I’ve done some diagrams for papers & presentations using Processing, and while that’s been successful, it’s a little clunky, and hard to share. Ideally I’d be able to both generate diagrams with code, and also adjust them with a mouse UI, with the changes being reflected in the code. Long experience with Omnigraffle makes me appreciate a good UI for finishing a diagram, but I always wanted to start out by generating with code…

          1. 2

            I’ve used Processing. I think it’s pretty good unless you’re doing something that needs high performance for some reason.

            1. 2

              Lua + LÖVE is also a great option. Lua has a very simple stack and has ‘eval’ (load(...)()) built-in with no code transformation etc. required. And is super fast with LuaJIT. Is very easy to bind more C++ stuff too if you want to.

              1. 2

                Not clojure but I built my own tool for this: https://github.com/vhf/plotwork

                1. 2

                  It’s worth mentioning Thi.ng by one of the article’s author, Karsten Schmidt. If you know Processing, he’s the main author of ToxicLibs. I didn’t manage to use Thi.ng last time I tried (I have no experience with Clojure), but got started with Quil within a few minutes. Thi.ng is worth having a look though, and the source code is an interesting example of literate programming using org-mode.