Fork me on GitHub

can you point some (not very long) examples of Clojure expressivity? Something to show to a person only introduced to mainstream languages to show the difference of LISP approach?


there are people who claim that "homoiconicity is overrated" and other languages have achieved certain level of power on par with LISP


when I advocate Clojure I usually follow Rich Hickey talks and speak about values, time, state, immutability


but immutability is default in languages like Rust and Kotlin


(Disclaimer: I don't have experience with kotlin.) One thing to consider is that immutability is more than just having a language construct like the Java final keyword: how idiomatic it is to handle immutable (and persistent) objects and collections(!) in the language (e.g. does the standard library expect you to use them). Clojure and its APIs embrace immutability and make it very pleasant to work with them. I don't know if the immutability in Kotlin is closer to just final or the way clojure operates, but my understanding is that at the moment it does not offer persistent collections (`kotlinx-collections-immutable` is still experimental).


I mostly do java projects and in order to actually get even close to the immutable concepts like clojure I need to a) use final everywhere, b) use libraries like org.immutables to construct objects and c) use libraries like to construct collections.


If you're trying to "sell" clojure, I think [] covers that well. The slide on how Clojure does what it does is:

slide title: How?

+ Data orientation

+ Simplicity

What matters is not just what a programming
language makes possible, but what it makes
         _practical_ and _idiomatic_.
With regard to expressivity, he talks about the different flavors of "small" when it comes to programming > So program size matters. Smaller is better. This is one of the few areas where we have research. People have done research and said: smaller programs have fewer bugs. It is just that simple. It does not matter what programming language it is. Smaller programs have fewer bugs. > > Bigger programs have more bugs, longer time to market. They are harder to maintain, and they are more brittle. > But what I think is interesting is that there are two flavors of small. A lot of languages focus on concision, which is size in the small. How small is your if statement? How small is a function call? How tiny are your constructs? How much overhead, how much syntactic stuff is there? And there are a lot of languages that focus on that: Ruby, and Python, and a lot of languages are actually very good at concision. > > But the bigger impact on a program overall is not moving from 42 characters to 20 characters. That only gets you 2x. The biggest thing is moving from more specificity, which bloats your program, to more generality, which shrinks it. That is the big payoff. That is the area where you are going to get a payoff much higher than 2x.

👍 3

another good talk is "Narcissistic design" by Stewart Halloway


Just watching that talk 😂


I face it every day writing in Go - things change under your feet all the time


@gr.evocatus Even after a decade of Clojure in production, I still don't find it easy to persuade people who only know mainstream languages. So much of what Clojure brings to the table is very alien to them. It's hard to get people past that at times.


For me, back in 2013 this was the talk that convinced me to to try Clojure I was very much into OOP pattern fetish, and kinda loved it. I think the key phrase for me was “just take a step back and imagine you don’t love it (OOP)” 🙂.


Yeah, I think you've really got to go through the cycle of loving OOP but then running into all the problems it causes and recognizing them -- and there's a lot of Stockholm Syndrome around OOP unfortunately...

😂 3

You’re probably right, unfortunately… Esp. since most people are taught OOP-centric, place-oriented languages as a first language… It’s the “industry standard” in 90% of cases


even children at schools hear "variable is like a box"


They should hear it, and should also hear “that is NOT a good thing in 98% of cases” 🙂


Unfortunately, most people don’t realize/know the second part


I'm a part time school teacher. And when I explain Python I never use this "box" example. I use "tag" and "name"


@gr.evocatus that’s a better one but unfortunately the real problem with Python and all other languages without value semantics is that there’s no way to know (without walking the whole data structure) if the world has changed underneath that tag/name;


It's interesting reading @viebel’s new book because it's focused on data-oriented programming -- Clojure's style -- but teaching it for "other languages".

👍 3

I wonder if there will be any changes to core.async (for clojure-jvm at least) once Project Loom is completed. In particular, maybe we would no longer need to have two different apis for >!/`>!!` , <!/`<!!`

Alex Miller (Clojure team)13:02:41

No plans to look at this until Loom is done and in an LTS release

❤️ 3
hiredman05:02:33 lists core.async as being under active regular development, so maybe rich is thinking about it right now


(I was going to say it was "stable" and not under active development but thought I'd check first)

Alex Miller (Clojure team)13:02:50

Still actively (but sporadically) working on it


Btw, not sure if this is the correct place to post this, but seems to be down (and has been down for the last days I’ve checked) I loved showing it to people who might want to try Clojure (and also doing some of the examples myself once in a while). Does anybody know who is in charge of 4clojure?


Very nice 🙂

Max Deineko13:02:08

Might it be worth reporting via <mailto:[email protected]|[email protected]> or github repo issue with location info? Fwiw it seems to be available & working from Austria..


Woah, it actually works from Chrome! (I normally use Safari)

👍 3

That is quite strange.


@U9TGHG3LP thanks for pointing this out

Max Deineko14:02:43

A quick test revealed that while wget, firefox & chromium all load 4clojure site fine on my machine, curl does report empty reply from server. So it looks to me like an older nginx version might be causing this: . There's already an open ticket with safari issue at 4clojure github repo, so I guess whoever's hosting the site will be made aware of the problem eventually..

👍 3

Why is this not in clojure.core on the JVM?

cljs.user=> (source dispatch-fn)
(defn dispatch-fn
  "Given a multimethod, return it's dispatch-fn."
  [multifn] (-dispatch-fn multifn))
/cc @wilkerlucio

☝️ 3
Alex Miller (Clojure team)13:02:38

Add an ask question, seems like a reasonable thing to want


Hi there. So I'm getting some weird behaviour from Clojure tools CLI and not sure if this is a bug or not. I have something like this in my options:

["-v" nil "Verbosity level; may be specified up to 2 times. Levels: INFO (Default) -> DEBUG -> TRACE"
    ;; If no long-option is specified, an option :id must be given
    :id :min-level
    :default 0
    :update-fn inc
    :validate [(fn [a]
                 (println a)
                 (<= a 2)) "Verbosity level cannot exceed 2."]]
and a is printed as true instead of either the level before or after applying update-fn. Is there a way to work around this so I can validate after update-fn has been called? Thanks in advance.


@rextruong :validate operates on the initial option value as part of the option parsing process; there's no subsequent validation step. It might be a useful enhancement so feel free to post it as a question on tagged in the tools.cli category and when I'm next making a pass over the Contrib libs I maintain, I'll create Jira tickets from things there.

Alex Miller (Clojure team)18:02:40

Not tagged - should be in the contrib libs / tools.cli category


Ah, right, ask has "tags" and "categories". Message updated.