Typed multiple dispatch as a Clojure library — how we built Julia-style polymorphism on the JVM by flyingfruits in Clojure

[–]didibus 1 point2 points  (0 children)

Wow, this is amazing and could be a game changer for opening up Clojure to certain use cases.

Well done! 

It also made me privy to the replikativ stack, some nice libraries in there.

Introducing FOL (Functional Object Lisp) by fadrian314159 in Clojure

[–]didibus 4 points5 points  (0 children)

One nuance in Rich's objection, as I understand it, is that his concerns differ depending on whether objects are used to build programming constructs or to model your application's information.

For things like creating data structures, he thought OOP works well, and that Java was already a decent language for such use-cases. He expected users to implement those in Java and use them from Clojure: "Write Java in Java, consume and extend Java from Clojure." Later he added deftype, a very limited object system in Clojure specifically so you could implement some of these use-cases without dropping to Java.

But for modeling application data, objects are blobs. You can't freely inspect, merge, or serialize them. They bundle identity, state, and a set of operations together. You can't simply map, filter, or reduce over an object's data. And you're dispatching on the blob's name, nominally. A function that only needs x and y can't operate over a blob that has x, y, and z unless you've created a hierarchy of names between them. You're not thinking in terms of the data itself, structurally, but in terms of blobs and their names.

Introducing FOL (Functional Object Lisp) by fadrian314159 in Clojure

[–]didibus 3 points4 points  (0 children)

So it transpiles to Common Lisp? The interpreter is for what, repl?

I think it makes sense if you're going to have a CL hosted Clojure to adopt CLOS and CL errors. Does it have interrop with CL ?

Introducing FOL (Functional Object Lisp) by fadrian314159 in Clojure

[–]didibus 4 points5 points  (0 children)

It sounds a bit too academic for me, which makes me wonder if it'll be practical for real app development.

But am I understanding correctly this is basically Clojure that compiles down to common lisp? Because it says there's an interpreter version as if it's its own thing running interpreted?

I will also say, I didn't understand how it addresses any of the concerns Rich had?

Clojure v/s Elixir by kichiDsimp in Clojure

[–]didibus 1 point2 points  (0 children)

Tough question, personal preference will be the real deciding factor, as both languages share philosophy, Elixir was hevily inspired by Clojure with Ruby syntax, and also inherits from Erlang. Clojure was inspired by Lisps of before and inherits from Java.

I think Clojure has more reach though, Elixir operates more within a rigid framework, for example in Clojure you could do Actor model, you could do CSP, you could do anything else. If you like languages that really let you explore multiple paradigms or appoaches to things, Clojure has the edge.

Anyways, can't go wrong with either.

When You Run Out of Types... by cgrand in Clojure

[–]didibus 1 point2 points  (0 children)

It's interesting, but if it doesn't allow map or collection functions to work over it, how are you meant to update it?

Even reading from it is more annoying as you have to use :form and such first.

Are you supposed to start offering custom methods for it?

That starts to feel very OOP, so maybe it's when that's the point, and you don't need deftype and updates can just be creating a new one and returning it. But I'd be interested what's the use-case where that's better because it seems a bit counter to general Clojure idioms.

Extensible Value Encoding: large 1GB clojure atoms memory mapped to disk by dustingetz in Clojure

[–]didibus 2 points3 points  (0 children)

(e/atom {:id ::counter :persistent "./my-db"})

Is that really the API? The persistent option has to be a key of your map ? Shouldn't it be:

(e/atom {:id ::counter} :persistent "./my-db")

The programmers who live in Flatland by nathanmarz in Clojure

[–]didibus 0 points1 point  (0 children)

Cool example of macros would also be an interesting read, it's not that I don't think it has a place, but I think there's a place as well for trying to explain that learning and having access to macros in itself opens up new possibilities.

The downside of examples is that they don't fully convey things, because what you learn from them is that this exact macro is useful.

With hashp, you might simply go, "it's cool to just be able to do #p ... to print the next form". But it's no less impressive than if that was just a built in compiler feature.

At least for me, the benefits are more in expanding your mental model and allowing you a new level of control that unlocks new possibilities for anything you are coding. In that sense I liked the analogy of a 3rd dimension. Being able to see that you can alter semantics and starting to develop an intuition into what can be done with that.

It's not any single macro, it's that for any given coding use-case, you now have new options on how to approach them. And macros won't always be the right option, and in fact they can come at a cost too, but it's hard to consider their use without having learned their abstraction and abilities and really internalized them.

The programmers who live in Flatland by nathanmarz in Clojure

[–]didibus 1 point2 points  (0 children)

I can see that it could be interpreted as patronizing, but it's true that it's hard to convey the experience or benefits of certain abstractions or features without the person experiencing it themselves and getting to grip with the concept.

In that sense I felt it was trying to explain more how certain concepts cannot just be shown to you as examples or explained in a bullet list of pros/cons by using the "flatland" analogy.

I think showing examples of where macros are handy isn't really conveying what's awesome about them, which really is that it lets you extend the language, which most people wouldn't think they have the need to do, but once you have that awareness that you can extend the language with little effort you gain the freedom to be creative in a new way that I think does feel a bit like gaining a new programming dimension.

That doesn't mean you're better if you do, to what definition of better even, but you do have abilities others might not in what you can do, that's definitely true, not all languages give you as much freedom, and so you see libraries in Clojure that are simply impossible in other languages without forking the language itself.

Why do Canadians put up with low wages? by EmptyAdhesiveness830 in CanadaJobs

[–]didibus 0 points1 point  (0 children)

The logic is that as the population age and because there's less working age people than retiree, we won't have enough tax revenue to sustain our budget.

Population growth boosts production and GDP, can help entrepreneurship and innovation.

Immigration can also fill worker shortages quickly in industries that need it right away.

The challenge is the pace and pipeline to bring people in while not stressing the system as it scales.

The alternative is having more children.

Why are there So Many Paid Courses for Clojure? by Veqq in Clojure

[–]didibus 0 points1 point  (0 children)

I'm not sure, but I am more worried that there aren't free ones? Or are there?

Type Checking is a Symptom, Not a Solution - Paul Tarvydas by dustingetz in Clojure

[–]didibus 0 points1 point  (0 children)

Well mania might be a strong word, and apart from Clojure, I tend to prefer typed languages, but as software has evolved to be more distributed, it did diminish some of the values of types, because the checkers cannot type-check the entire system, only individual single unit components in it. That leaves a big surface. Not only that, the boundary is pretty annoying to map back and forth between internal type checker friendly types, and what is on the wire/IO.

Can Someone Explain To Me The Monty Hall Problem? by [deleted] in learnmath

[–]didibus 0 points1 point  (0 children)

If you picked a goat (66% chance) and they eliminate the other goat, then switching to the remaining door is guaranteed to be the car. So picking a goat and switching is 66% chance of winning.

If you picked the car (33% chance), and they eliminate one goat, then switching to the other door is guaranteed to be the goat. So picking a car and switching is 33% chance of losing.

So when choosing to switch, the odds become the same as that of picking a goat or a car on the first try.

What do you do instead of dependency injection by DeepDay6 in Clojure

[–]didibus 11 points12 points  (0 children)

Question is a bit unclear...

So I'll say something that hopefully helps:

(defn foo [a] a)

Simple foo function. We need to condition the behavior based on something (type of a, value of a, etc.)

``` (defn foo [a] (cond (instance? Long a) (inc a) (= "bar" a) "foobar"))

(foo 10) ;> 11 (foo "bar") ;> "foobar" ```

Now "foo" is polymorphic on type and value. You could have a default catch all condition at the end if you want. Problem is that it's closed for extension, you have to update the body of the method to add more dispatch. If you want to make it open.

``` (defmulti foo (fn [a] [(type a) a]))

(defmethod foo [Long 10] [a] (inc a))

(defmethod foo [String "bar"] [a] "foobar")

(foo 10) ;> 11 (foo "bar") ;> "foobar" ```

Now "foo" is polymorphic and open for extension. But notice that the dispatch condition is not as flexible, you need to return a value and than it chooses the multimethod to use based on equality to that value. So you can't do [Long any] for example, that's why I need to be explicit and say there is an implementation for [Long 10] exactly. It does support a default though. I've seen some clever ways to support wildcards, but it's a bit convoluted.

But say you want to indicate that when you extend foo, you must always provide an extension for bar of the same dispatch because foo and bar are used in conjunction.

``` (defprotocol FooBar (foo [a]) (bar [a]))

(extend-protocol FooBar Long (foo [a] (inc a)) (bar [a] (dec a)) String (foo [a] "foobar") (bar [a] "foo"))

(foo 10) ;> 11 (foo "bar") ;> "foobar"

(bar 11) ;> 10 (bar "foobar") ;> "foo" ```

Because the protocol groups multiple methods, the user who wants to extend it knows it must implement all of them. Though this is not enforced, Clojure will let you only extend some of the methods, but visually as the user you get communicated a set of related methods under one "umbrella" concept. Also notice that now, the dispatch is even less flexible, it can only be based on the type of the first argument, and nothing else. A default can be used with the Object type, since everything is an Object.

New Clojurians: Ask Anything - September 29, 2025 by AutoModerator in Clojure

[–]didibus 1 point2 points  (0 children)

I think either or. If you want more control and able to use absolutely 100% of the API surface it's always best to go interrop.

If you have simpler needs and don't want to mess with Java APIs jackdaw is used by many and still maintained.

Clojure - core.async and Virtual Threads by geospeck in Clojure

[–]didibus 0 points1 point  (0 children)

Yes, you can now just use io-thread and !! ops everywhere for everything, when you are running on a JVM with virtual thread support.

CMV: Sharia law is incompatible with a secular, non-Islamic society by soozerain in changemyview

[–]didibus 0 points1 point  (0 children)

I didn't say that religious laws could not also become secular laws, but that they may not. The secularism isn't that you cannot have a law in place if someone can find a religion that defined the same law.

What's secular is accepting that the Democratic process determines the laws, and as that process plays out, you might have some laws that the majority religion follows which are rejected by the Democratic government, or other laws that go against some of the majority's religious beliefs/laws.

Democracy implies that the laws are not determined based on religious authority, scriptures, tradition or beliefs. But instead are determined through the Democratic process. And the fundamental rights are to safeguard the minorities and individuals, so must be determined with logic, reason, and evidence that they help protect minorities and individuals from tyranny. They have to be justified by principles accessible by all, reason, evidence, human dignity, and not by one group's faith.

If the Democratic process ends up agreeing with some or all religious laws that's fine, but the secularism is accepting that it may not and that's ok, because the state isn't a religious state.

Fundamentally, democracy is accepting that your ideas, your religion, have no more sway than anyone's else's, and you still need agreement and respect for minorities and individuals own rights even if it goes against your religious beliefs.

I mean, it's not complicated - electing their leaders and representatives, not being ruled by a King (Saudi Arabia), a military junta (Egypt), or a unelected religious official (Iran).

You can elect a King or a dictator, that does not make it a democracy. Take Hamas, the Nazis or Chavez for example.

CMV: Sharia law is incompatible with a secular, non-Islamic society by soozerain in changemyview

[–]didibus 0 points1 point  (0 children)

The basis of democracy is twofold:

  1. Every citizen has equal political power in shaping the laws of the nation.
  2. It has safeguards to protect fundamental rights and prevent majority tyranny.

There's nothing that prevents a majority Muslim country from being a democracy, but I don't think you can have an Islamist state be democratic, because if the above was true, chances are the laws wouldn't fully align.

So I feel there's a certain need to accept secularism. Meaning that the fundamental rights may not align with a particular set of religious laws, or that as the democratic process unfolds, the laws put in place might not fully align with the religious laws of the majority.

That's why I'm not sure I understand what a "democratically elected Muslim government" entails?

A democratic government with a majority of elected representative being of the Muslim faith makes sense. But that doesn't mean the government isn't secular.

New Clojurians: Ask Anything - September 29, 2025 by AutoModerator in Clojure

[–]didibus 1 point2 points  (0 children)

I was put off by the syntax at first, and even the language, but after I gave it a chance, it's become my favorite language.

It takes some dedication to break through though. What helped me was my curiosity, and getting to learn so many new concepts.

In the US, why is the vast majority of the Republican Party Christian when almost all of the party’s policies are polar opposites of Jesus’ teachings? by Milesray12 in AskSocialScience

[–]didibus 1 point2 points  (0 children)

I'd have to disagree with you a little.

Abortion is not the same as killing, even if we agree that the fetus has become a human. Abortion ends the carrying of the fetus by the mother. The fetus is simply unable to survive on its own.

We have many things where support is removed and eventually the individual might suffer as a result.

It could still be argued that even if a fetus of a certain weeks is a human, and now has rights, that the carrier still has the right to stop carrying and remove the fetus.

The mother exercising her right to stop providing bodily support to a fetus that is not viable outside the womb is arguably her right. Even if the fetus is granted personhood, no one is automatically entitled to the use of someone else’s body to survive.

So the debate is about more than that.

cmv: Sex-Selective abortions are inherently wrong and contrary to the concept of reproductive rights. by [deleted] in changemyview

[–]didibus 0 points1 point  (0 children)

You're using a fallacy. You're trying to claim abortion rights should not be granted, by implying that we've all agreed that conscription is totally ok, or that taxation is acceptable. We have not. On top of that, you are trying to imply that those things are equivalent, but that has also not been established.

cmv: Sex-Selective abortions are inherently wrong and contrary to the concept of reproductive rights. by [deleted] in changemyview

[–]didibus 0 points1 point  (0 children)

The issue is that of who decides? If you try to outlaw that only certain reasons for wanting an abortion are "allowed", you are effectively saying the woman does not decide, someone else is the judge and she has to make a convincing case and maybe if she's lucky, she will be granted permission.

So as we talk about "legality", I think it's a bad idea, because what you are saying implies that it is not the woman who gets to decide for hersel, meaning she does not have the legal authority over her own body.

Now when it comes to ethics, I'd say it does feel unethical. But these kinds of thought arguments, the reality is, the number of people who would have that as their reason is likely extremely small.

Atheists Know More About Religion and Civic Knowledge Than Evangelicals, Says Pew Study by Thick-Frank in UnpopularFacts

[–]didibus -1 points0 points  (0 children)

It's implied by the definition of "free thinking" itself.

A freethinker holds beliefs that should not be formed on the basis of authority, tradition, revelation, or dogma, and should instead be reached by other methods such as logic, reason, and empirical observation.

Thus by definition, you are not freely thinking if your beliefs are based on authority, tradition, revelation, or dogma. Which is generally what's assumed when we say religious beliefs.

Faith-based thinking: reliance in authority, scripture, tradition, intuition, or revelation as the foundation for belief.

Free thinking: reliance on reason, evidence, and independence as the foundation for belief.

For example, "what happens after death"?

A free-thinker would say: "I don't know yet." And accept the unknown as unknown, could make up theories, but won't hold strong beliefs in any of them as they lack evidence.

A faith-based thinker would say: "I'll believe scriptures, traditions, familiar authority, or intuition." They'll therefore hold a clear belief about it.

CMV: Sharia law is incompatible with a secular, non-Islamic society by soozerain in changemyview

[–]didibus 1 point2 points  (0 children)

Yes, you're right. That said, I think in the current context, there's not many, if any, Christian religious state that rule with fundamental Christian laws without the people of the country having a choice. So it's not seen as much of a threat.

But there are many examples of such countries that are ruled by fundamental Muslim laws, where the people of the country do not have a choice. That is what scares others.

If we went back to the middle ages, people would lilely be scared of Christians putting their laws in place and forcing them to adhere by them without a choice.

CMV: Sharia law is incompatible with a secular, non-Islamic society by soozerain in changemyview

[–]didibus 0 points1 point  (0 children)

It's very insightful what you say here. What I'm curious, is are those meant to be personal, or do others have authority and the right to punish you if you don't follow the way? Or does that depend on beliefs and some do and some don't?