@meow: @mikera: my sense is that there’s nothing wrong (or even unidiomatic) with using mutability quite freely as long as it’s confined within a limited scope, typically a single function. & see http://clojure.org/transients
@eggsyntax: Sure, and I do use transients sometimes.
Giving serious thought to writing a polygon mesh processing library using vectorz for the data representation.
:thumbsup:
This has to be the most concise implementation of Conway's Game of Life in clojure that I have seen, and I think I've seen a lot of them: https://github.com/mikera/core.matrix/blob/0cf43fe3b3a1992aec2fbe041ae0ab5ed34d02b5/src/test/clojure/clojure/core/matrix/demo/life.clj
Would also love to extend my ergo
library of l-systems and cellular automata code to use vectorz
as well. Very curious to see what kind of performance improvement I could get.
@meow: that's tiny!
I know, right!
Of course, like all such efficient implementations it gives up a lot of flexibility.
I have some CA code that is very flexible, but I'm sure not as fast: https://github.com/decomplect/ion/blob/master/src/ion/ergo/core.cljc
Here's Yin-Yang-Fire using Quil: https://github.com/pkobrien/sandbox/blob/master/quil_sketches/src/quil_sketches/ergo_ca_yin_yang_fire.clj
@mikera: When you have some spare time I would love to see a few more examples of how I could use clisk functions on these polygon meshes. I made some changes to how the clisk functions get used. Now the call looks something like this: (op/colorize (partial mc/clisk-sampler clisk/vnoise))
I tried to use some other functions like (op/colorize (partial mc/clisk-sampler clisk/agate))
and the results aren't good. I'm sure I don't understand something fundamental.
The clisk-sampler
function lives here: https://github.com/pkobrien/cad/blob/master/src/cad/mesh/color.clj#L205-L211
(defn clisk-sampler [colorer mesh]
(let [sampler (clisk/sampler (clisk/node colorer))
fc (fn [_ face]
(let [[x y z] (gu/centroid face)
color (sampler [x y z 0])]
color))]
[mesh fc]))