Skip to content

Comment on Neat Algorithms - Flocking

Comments

And here's a parallel version written in Clojure that scales across your cores, https://github.com/swannodette/flocking/blob/master/src/floc...

You sure are pretty prolific in the Clojure community. I look at my Clojure code and then I look at yours and I wish mine was as elegant as yours.

To be honest I continued to work on my Clojure flocking code long after it was working.

I actually took this code as challenge to learn how to put together idiomatic, fast Clojure code that read better than the original Java on which it is based.

Of course, nearly a year later since I wrote this version, I can see ways to make it even faster (nearly on par with Java and faster when parallel), cleaner and more elegant.

Do have any tips for someone looking to do better?

Partly it's API familiarity - clojure and clojure.contrib have a LOT of functions to offer, and a lot of the time may have higher order functions to do what you might be doing the hard way :)

AboutSource Built by g1lg1l

Hackerly is an independent reader for Hacker News, built on the public HN API. Not affiliated with Y Combinator.