3 ms·
The cheatsheet is very handy! Thank you. I'd completely forgotten about it. I usually end up poking around Clojuredocs, but it's very unstructured and you're ju
by geokon 5y ago
The cheatsheet is very handy! Thank you. I'd completely forgotten about it. I usually end up poking around Clojuredocs, but it's very unstructured and you're just hunting for a function that fits the bill.
And yeah, your analysis of functional programming paradigms in Clojure mirrors how I think of it as well. I see that a lot, how the language is really pushing you to program functionally and almost intentionally making imperative/mutable programming painful so that you don't do it :)
Now that you've explained it it does seems obvious that arrays don't work too well with immutable structures. You're right about the OCD. C++ kinda instills that in you a bit. It feels "wrong" to have sequences of the same datatype (like pixels in an image) use the same container as sequences of varying data types (like a hiccup vector). For instance cache misses are something one is used to worrying about in C++ while in Clojure it's not even on the radar
I really appreciate you taking the time to explain things - especially so deep down in a thread
- geokon 5y agoI just noticed you can actually leverage `into-array` at critical parts - if you just need a data collection for quick traversal.
- didibus 5y agoIf you're interested in high-performance Clojure, these articles are good: https://dragan.rocks/articles/18/Fluokitten-070-map-reduce-primitive-arrays-without-macros https://dragan.rocks/articles/18/Fluokitten-070-map-reduce-p... Fluokitten and Neanderthal are great for high performance numerics. Can't really get any faster than Neanderthal (which uses MKL and the GPU for compute). And fluokitten can make working with arrays a bit nicer, in that it'll look a bit more like working with sequences, though you still need to be careful about the functions you use with it to avoid boxing. https://clojure.org/reference/java_interop https://clojure.org/reference/java_interop Read the section about type hints and working with primitive types and the optimization tips section.
- geokon 5y agooh woah very cool! sorry for the late response - I wanted to take the time to look at it more closely. Thanks for that info. I'd never really looked into Fluokitten. It looks awesome :D I've played with Neanderthal but the MKL dependency is a bit annoying (doesn't work on my Pinebook Pro and I can't ship binaries with it) - so I'd overlooked Fluokitten entirely. But this is very complementary to the Clojury way of doing stuff and has no dependencies. I'm def going to try to work this into my standard toolbox :)) I've only done the normal java-interop stuff in the past but this looks like a definite step up