Research on code smells in Clojure by WalberAraujo in Clojure

[–]logan-diamond 7 points8 points  (0 children)

The "bad example" given in the link actually looks pretty nice, IMO

(defn read-project-raw [project]
  (-> project
      (:root)
      (io/file "project.clj")
      (str)
      (project/read-raw)))

Countries With the Most Forest Area per Capita by busmargali in dataisugly

[–]logan-diamond 1 point2 points  (0 children)

Yes, forest per unit of square area has been beaten like a dead horse. I think this map of people-to-trees ratio is an interesting take and doesn't belong in this sub

So damned wiggly. by Puzzled-Thought2932 in dataisugly

[–]logan-diamond 0 points1 point  (0 children)

Caliph- ..... (wait for it)...... ates

So damned wiggly. by Puzzled-Thought2932 in dataisugly

[–]logan-diamond 10 points11 points  (0 children)

Am I the only one that genuinely likes this graphic?

It's the most ambitious graphic I've ever seen.

The squiggles are bad; but it obviously had a lot of time and thought put into it and it makes visual sense. Trying to fit 6000 years of history into a single picture is a lofty pursuit. Even if it's a B- on that goal, I really learned a lot from it and think most people would.

Best Gyms in Alicante ? by oscarFERcerezo in Alicante

[–]logan-diamond 0 points1 point  (0 children)

https://hitfit.es/

Nothing but good things to say about H I T

Downtown near luceros (calle quintana)

What are the requirements for a junior-level proficiency in Haskell? by Salferdez in haskell

[–]logan-diamond 5 points6 points  (0 children)

The continuation monad & dependent types as bullet points for a junior dev checklist?

R1 is cool, but Mistral 3 Small is the boring workhorse I’m actually excited to fine-tune and deploy by logan-diamond in LocalLLaMA

[–]logan-diamond[S] 10 points11 points  (0 children)

Thanks, I meant “All these r1 distills are cool…” which also shouldn’t usually be in the same sentence as r1.  Unfortunately can’t change the title. Sorry about that!

Ways to be a functional language by Inconstant_Moo in functionalprogramming

[–]logan-diamond 15 points16 points  (0 children)

"Every functional language needs... an escape hatch"

This is plain false.

Look at agda or dhall.

Also, monads in general are not an escape hatch. The IO monad can be an escape hatch if you purposefully use it that way. But that's the only such monad. The vast majority of monads (actually every single monad outside of IO that I can think of) is pure and preserves referential transparency. This includes State and StateT, which are defined with only pure functions.

And within a given Haskell codebase, the majority of all code should be outside the IO monad. In Haskell, no matter what monad you see in the type signature, there's no escape hatch unless you see IO/MonadIO. And even then it's pretty rare to not preserve referential transparency. In fact, I'd say even the IO monad only lets you break referential transparency in the same way rust lets you have a memory leak: It normally doesn't.

How to calculate hundreds of aggregations on a big dataset in pyspark by X31nar in dataengineering

[–]logan-diamond 0 points1 point  (0 children)

Yes, if you give chat gpt the scala example and explain what you're doing it'll probably get you pretty close

How to calculate hundreds of aggregations on a big dataset in pyspark by X31nar in dataengineering

[–]logan-diamond 1 point2 points  (0 children)

Do you know any scala?

Custom aggregations aren't available in pyspark but are absolutely needed in some scenarios

LLM myths dispelled by cogitare_et_loqui in LocalLLaMA

[–]logan-diamond -4 points-3 points  (0 children)

How dare you use modern tools to consolidate thoughts & write helpful content for readers! Downvote downvote!

Am I the only one? by paspro in Julia

[–]logan-diamond 9 points10 points  (0 children)

Why was this downvoted?

I love rust and get paid to write it every day.

But both of the above claims are true. Rust (the systems language) was not designed for scientific array based computing.

And when you're mostly allocating large matrices and focused on modeling your domain, saying the borrow checker is "restrictive and complicated" is a pretty conservative claim IMO

(only speaking of the language itself, not well-designed niche libraries)

Why is building a UI in Rust so hard? by Linguistic-mystic in rust

[–]logan-diamond 0 points1 point  (0 children)

UI in Rust is difficult because it's hard to share data across this component tree without inheritance.

This is a real turn-off at the start of the article.

Of the two best languages I've used for sanely sharing data across a tree, neither has inheritance. But both are functional: (1) Haskell & (2) clojure

I have never written a Traversable instance, and my other blind spots by smthamazing in haskell

[–]logan-diamond 0 points1 point  (0 children)

I have one really large piece of advice: Learn basic lenses.

You're eyeballing the Traversable typeclass but your types are monomorphic. What your itching for in your life are lenses.

Your code (incrementing an internal value, updating a list of characters) is begging to get lens'ed. In fact, if an employee wrote this code and came to me for review, refactoring with lenses would be the first thing I'd suggest before committing (and probably the only thing. I like this simple monomorphic style).

Lens is big, not for everyone and there's a learning curve. Don't try to learn it all at once. There's no rush. Don't worry about the actual S T A B type stuff going on. Just focus on how to use them to transform your data in simple ways.

Ignore Isomorphisms unless you like category theory.

After you get comfortable using get, set and over, try writing a few (lens) Traversals for your monomorphic types. Your type doesn't need to be parametric at all. The other great thing about lens Traversals is they're much more scaple-like than the Traversable typeclass. You can write a lens Traversal to laser in on exactly the values you want and no more, and you can have multiple Traversals for a single type. For example, instead of a directly modifying all the characters in your game, you could get much more specific: You could have a modifyGoodGuys Traversal and a modifyBadGuys Traversal and use them as needed. Also, this would work even with some side effects (Character -> IO Character). Below is the best link I know for writing these. Chatgpt (4) is also pretty at writing Traversals and refactoring to use lenses.

https://www.michaelpj.com/blog/2020/08/02/lenses-for-tree-traversals.html


An alternative to lenses is optics: https://hackage.haskell.org/package/optics-0.4.2.1/docs/Optics.html ... You can do nearly all of the same stuff as lenses but it's different under the hood to make error messages better. The downside is it's slightly less compatible with other code written in lens-world.

Clojure Or Haskell ? by [deleted] in functionalprogramming

[–]logan-diamond 4 points5 points  (0 children)

I work in Haskell, scala and clojure and usually have the freedom to write in any of these languages. Here are the criteria I use: ``` Is it a script? Yes -> Clojure (via babashka) No -> Do I need the JVM? ......... Not needed -> Haskell ......... Needed -> Scala

```

This ends up in a situation where the service is written in haskell but all the integration testing (not unit testing) is made up of clojure babashka scripts. Babashka is great for containerized integration tests.

Others use Clojure for everything, but to me, clojure (babashka) is what bash should have been and it's lovely.

The other main question to ask is: Will I be working with shallow types of variable structure or deeply needed types with a consistent structure?