I'm going to harken back to the Sieve of Eratosthenes question from page 4. I'm starting to fiddle with Clojure (I'd started in Racket but didn't like the docs). One of my biggest motivations was being able to more simply implement symbolic differentiation and machine learning stuff. The tricky part with that is I'm generally only familiar with the cases where you have really big matrices which are updated a whole bunch of times. I've heard Clojure keeps around old references, and that worries me. I know they don't use copy-on-write, but something more efficient. All the same, when you've got structures that don't fit into memory and require dozens of updates, it makes me a little concerned about how that's going to work out in a purely functional language, or if it's not objectionable to have side-effects by design. Does the matrix become the mutable state of the application?
|
|
# ¿ Mar 4, 2016 23:15 |
|
|
# ¿ May 15, 2024 04:37 |
Tequila Bob posted:Clojure is totally cool with your mutable state. If you want to mutate a huge matrix while using idiomatic code, I'd recommend that you use "transients" (http://clojure.org/reference/transients). Clojure's vectors are capable of transient operations, so you should be able to represent your matrix as a transient vector of transient vectors. You can code like it's Clojure and consume memory like it's imperative code manipulating one global blob of memory! I had no idea about transients! That seems to be precisely what I need. It's going to take me a while to figure out how to re-fit my mental model of the problem to use them, but I'm thinking that will handle it. I've been bitten by memory consumption problems with this problem domain before, so I'm always on the lookout. Our production server has 128 gigs of ram and I'm still bumping up against that limit when I run the application full tilt. I'd love to get utilization down, but there's only so much that you can do when you've got a giant multi-gigabyte matrix that you're constantly rebuilding. EDIT: Follow-up question because I don't want to bump. I wrote a simple automatic differentiation method and was wondering about a certain operator comparison. code:
Is there a consistent way to check operators? Sometimes they seem to go to clojure.core/+, sometimes to +, and sometimes to #<native method blah blah.> Jo fucked around with this message at 23:48 on Mar 10, 2016 |
|
# ¿ Mar 8, 2016 07:09 |
I think I had heard of Elm a while back and it looks like a nice alternative to writing JavaScript. I've got some reservations about it, mostly related to what looks like mixing of styling and code in their examples. Has anyone styled an Elm app with CSS on top of their HTML generation?
|
|
# ¿ Apr 28, 2016 22:12 |