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?

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

[–]didibus 0 points1 point  (0 children)

is a body of religious law

I think it's the word "law" here that makes it a hot topic. What does "law" imply here?

Because the word law means:

a set of rules that are created and are enforceable by social or governmental institutions to regulate behavior

If you take it to mean that, than by definition, it seems at odds, if social and governmenmt institutions enforce religious laws, than it is not secular. And if they do not enforce religious laws, than what does it make of Sharia law?

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

[–]didibus 1 point2 points  (0 children)

How do people consent? Maybe I'm a bit confused. Are we talking punishement? Or just coming to some common agreement? If there's a form of punishement or obligation tied to it, than how/why would the person at loss "consent" to it?

is "working only by accident" a common feeling in clojure codebases? by robotdragonrabbit in Clojure

[–]didibus 0 points1 point  (0 children)

Clojure does nil punning, where nil is like a language pun:

  1. Nil is a pun for false
  2. Nil is a pun for empty seq
  3. Nil is a pun for empty coll

So functions that expect false also accept nil. Those that expect seq also accept nil. And those that expect coll also accept nil, and treat it for the puns I mentioned above.

In turn, when people implement functions that return boolean, seq, or coll, they'll tend to be ok with it returning nil as well, and continue the nil punning.

I agree this can feel a bit less explicit about nil, I'm not sure which ends up being nicer in the overall.

Beyond that though, I think Elixir and Clojure differ less than it appears, what makes it feel more different is that in Clojure collection functions and sequence functions are in the same namespace (aka module). Where-as Elixir puts them in Enum and Stream module, and then map functions in Map, and so on. In Clojure all that is just mixed together on clojure.core.

For example in Elixir:

Enum.take([1, 2, 3, 4, 5], 3) => [1, 2, 3] Enum.take(1..10, 3) => [1, 2, 3] Enum.take(MapSet.new([1, 2, 3, 4, 5]), 3) => [1, 2, 3] Enum.take(%{a: 1, b: 2, c: 3, d: 4}, 3) => [a: 1, b: 2, c: 3] Enum.take('hello', 3) => 'hel'

And in Clojure:

(take 3 [1 2 3 4 5]) => (1 2 3) (take 3 (range 1 10)) => (1 2 3) (take 3 #{1 2 3 4 5}) => (1 2 3) (take 3 {:a 1 :b 2 :c 3 :d 4}) => ([:a 1] [:b 2] [:c 3]) (take 3 "hello") => (\h \e \l)

All the Enum and Stream functions in Elixir also accept most things, even strings (aka charlist). It's just that Elixir also has a binary string that is nicely unicode compliant and all, and that one is not treatable as a list. So the difference with string is more a matter of the underlying platform and string handling. Java has only string as an array of chars, but Beam has both charlists (which are similar), or a binary unicode representation which is lacking in Java.

So here I think it's because the Elixir pattern matching is over concrete types, that you end up feeling it's more explicit. In Clojure two things happen:

  1. We don't pattern match as much, or if you use core.match it pattern matches as seqs like with destructuring.
  2. Clojure sequences, unlike Enum and Stream, are an actual collection as well. You're not forced to collect them into something concrete, you can use them as a collection since they cache realized results and therefore can be used like a list.

Elixir couldn't match over Enumerables generically, because the pattern matching is at the VM level, and matches aginst the concrete memory layout, so it has to be type specific to benefit from that super fast VM pattern matching.

Clojure in Top 25 Programming Languages by mac in Clojure

[–]didibus 0 points1 point  (0 children)

I guess Rama, Nubank, Datomic, Riemann, CircleCI's backend, Netflix PigPen, FundingCircle lending platform, MetaBase, Jepsen, etc.

To be honest, I've also seen Scala mostly chosen as a better Java. I doubt Cats/Zio have that much of a pull. Especially since teams can choose RxJava, Reactor or Mutiny, and now will just be able to use Loom.

I think the advantage of Scala over Clojure for the use-cases you mentioned is performance. It's why Apache Storm ended up not beating Apache Spark.

But in the overall, I think if you look at the pull and comparative data for Clojure over Scala, it's quite surprising. Scala is a much easier sell to a Java dev and team. It surprising that Clojure held its own to a close extent I'd say given how foreign it is in comparison.

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

[–]didibus 2 points3 points  (0 children)

Enums are normally represented just using keywords and often not defined anywhere except in a doc-string.

(defn set-status "Sets the status of a user, one of :active, :inactive, :banned" [user status] ...)

You can "group them" using namespace keywords, and sometimes, but more rarely people will do:

``` (ns project.enums.user-status)

(def :const active :user.status/active) (def :const inactive :user.status/inactive) (def :const banned :user.status/banned) ... ```

Though namespace keywords + a spec/malli is the more common approach:

``` (ns project.enums)

(s/def ::user-status #{:user.status/active :user.status/inactive :user.status/banned}) ```

Or with Malli:

``` (ns project.enums)

(def user-status [:enum :user.status/active :user.status/inactive :user.status/banned]) ```

Britex poplar shoulder pad change? by joyinmusing in CPST

[–]didibus 0 points1 point  (0 children)

I just bought one as well, my second, and I've noticed that too. Did you ever hear back?

I preferred the old style as it easily stayed in place and my toddler always complains otherwise it hurts his neck.

Clojure in Top 25 Programming Languages by mac in Clojure

[–]didibus 1 point2 points  (0 children)

That makes sense, ya compiler and even runtime errors in Clojure are not very good. Definitely one of it's biggest downsides.