clojure

New to Clojure? Try the #beginners channel. Official docs: https://clojure.org/ Searchable message archives: https://clojurians-log.clojureverse.org/
steffan 2021-02-27T00:24:34.284600Z

<http://grep.app|grep.app> could be what you are looking for: https://grep.app/search?q=reagent&amp;filter[path.pattern][0]=deps.edn https://grep.app/search?q=reagent&amp;filter[path.pattern][0]=project.clj

evocatus 2021-02-27T02:09:32.288200Z

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?

evocatus 2021-02-27T02:10:44.289200Z

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

evocatus 2021-02-27T02:12:03.290600Z

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

evocatus 2021-02-27T02:12:57.291200Z

but immutability is default in languages like Rust and Kotlin

phronmophobic 2021-02-27T02:25:53.293900Z

If you're trying to "sell" clojure, I think https://www.youtube.com/watch?v=VSdnJDO-xdg [https://github.com/matthiasn/talk-transcripts/blob/master/Hickey_Rich/ClojureMadeSimple.md] 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.

👍 1
evocatus 2021-02-27T02:27:44.294800Z

another good talk is "Narcissistic design" by Stewart Halloway

raspasov 2021-02-27T12:36:16.307400Z

Just watching that talk 😂

evocatus 2021-02-27T02:29:10.296400Z

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

seancorfield 2021-02-27T02:52:11.297900Z

@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.

raspasov 2021-02-27T10:30:25.306100Z

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

evocatus 2021-02-27T10:52:45.306300Z

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

raspasov 2021-02-27T11:07:47.306500Z

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

raspasov 2021-02-27T11:08:14.306700Z

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

evocatus 2021-02-27T13:42:54.316400Z

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

raspasov 2021-03-05T08:22:19.117800Z

@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;

seancorfield 2021-02-27T02:53:19.298900Z

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".

👍 1
JoshLemer 2021-02-27T05:11:01.300900Z

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 &gt;!/`>!!` , &lt;!/`<!!`

alexmiller 2021-02-27T13:33:41.311700Z

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

❤️ 1
2021-02-27T05:18:33.302300Z

https://clojure.org/dev/contrib_libs lists core.async as being under active regular development, so maybe rich is thinking about it right now

2021-02-27T05:19:37.304200Z

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

alexmiller 2021-02-27T13:32:50.310700Z

Still actively (but sporadically) working on it

raspasov 2021-02-27T06:06:03.304500Z

For me, back in 2013 this was the talk that convinced me to to try Clojure https://www.infoq.com/presentations/Are-We-There-Yet-Rich-Hickey/ 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)” 🙂.

seancorfield 2021-02-27T06:44:29.305100Z

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...

😂 1
lassemaatta 2021-02-27T07:17:26.305300Z

(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).

lassemaatta 2021-02-27T07:20:58.305500Z

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 <http://vavr.io|vavr.io> to construct collections.

raspasov 2021-02-27T12:47:25.309300Z

Btw, not sure if this is the correct place to post this, but https://www.4clojure.com 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?

borkdude 2021-02-27T12:55:04.309400Z

Maybe an alternative meanwhile: https://github.com/porkostomus/4bb

raspasov 2021-02-27T13:11:07.309800Z

Very nice 🙂

borkdude 2021-02-27T13:34:11.312200Z

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

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

☝️ 1
aratare 2021-02-27T13:38:23.315100Z

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) -&gt; DEBUG -&gt; 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)
                 (&lt;= 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.

alexmiller 2021-02-27T13:40:38.316200Z

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

2021-02-27T13:50:08.316600Z

Might it be worth reporting via <mailto:team@4clojure.com|team@4clojure.com> or github repo issue with location info? Fwiw it seems to be available & working from Austria..

raspasov 2021-02-27T14:10:12.317300Z

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

👍 1
raspasov 2021-02-27T14:10:20.317500Z

That is quite strange.

raspasov 2021-02-27T14:10:41.317700Z

@max.deineko thanks for pointing this out

2021-02-27T14:49:43.318100Z

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: https://stackoverflow.com/a/55067301/4386035 . 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..

👍 1
seancorfield 2021-02-27T17:59:27.322700Z

@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 http://ask.clojure.org 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.

alexmiller 2021-02-27T18:04:40.323300Z

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

seancorfield 2021-02-27T18:08:01.323600Z

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