this post was submitted on 27 Dec 2024
6 points (100.0% liked)

General Programming Discussion

8293 readers
2 users here now

A general programming discussion community.

Rules:

  1. Be civil.
  2. Please start discussions that spark conversation

Other communities

Systems

Functional Programming

Also related

founded 6 years ago
MODERATORS
you are viewing a single comment's thread
view the rest of the comments
[–] yogthos@lemmy.ml 3 points 1 year ago (1 children)

Indeed, and it's also worth noting that doing parallelism in Clojure is inherently easier than in an imperative language since data is immutable by default. If you're using Python or Ruby then you have to consider parallelism up front in your design, meanwhile with Clojure you can just swap map with pmap.

[–] Ephera@lemmy.ml 2 points 1 year ago (1 children)

Ah, interesting. I'm currently in the Rust rabbit hole, which takes a very different path towards race condition safety (it's imperative and the compiler separately checks that you're not using mutability in parallel contexts), but you actually get quite a similar feature, in that you can swap .iter().map() with .par_iter().map() (via a library).

[–] yogthos@lemmy.ml 2 points 1 year ago

Yeah, borrow checking approach in Rust is pretty neat since it lets the compiler track exactly where a data structure is being mutated at compile time. Rust approach is more efficient overall as well, but structural sharing has its own benefits as well since you get stuff like history for free. XTDB is a neat project that leverages this property for a temporal db.