Fork me on GitHub
#clojure
<
2023-07-28
>
mx200018:07:57

# Rename Clojure best language * Low adoption * Need to make waves/marketing * We believe in our language * Who goes through all the effort just to rename something? The most successful man in the world - Elon Musk Sending a message - no mature programming language has been renamed before Will become famous to all developers worldwide Now the big question: how would you name clojure if you would have to name it ?

👎 22
spam 4
5
2
😄 1
👍 1
mx200018:07:41

The most famous and popular language has just one letter - C and C++, So I suggest X

xapix 9
5
respatialized18:07:01

Oh this is a bit isn't it

mx200018:07:27

I am serious by the way , just hypothetically

p-himik18:07:06

I'll pretend that I didn't see that message and will keep on thinking that it's a bit. :)

😂 12
mx200018:07:41

I will fork clojure and call it X

p-himik18:07:21

> no mature programming language has been renamed before And this is also wrong. Perl 6 -> Raku immediately comes to mind, and I'm certain there were others that I can't recall right now.

3
Joshua Suskalo18:07:47

LiveScript->JavaScript->ECMAScript

pppaul21:07:40

javalisp2023

phill21:07:29

Scheme -> Racket -> Rhombus?

phill21:07:06

JavaScript -> ECMAScript?

phill21:07:57

Oh well, if it must happen... Is the name "Hammock" already taken?

vemv21:07:40

although sadly it's not there anymore, someone once created a PR against clojure/clojure renaming every single occurrence of "Clojure" with "Lava" (lisp on java)

10
Noah Bogart20:07:22

Is there a way to override a protocol method implemented on a defrecord?

frozenlock20:07:02

If it's for immediate use, just before the method call, you could use reify.

frozenlock23:07:31

I just wrote a lazy function and now I see this... https://clojure-goes-fast.com/blog/clojures-deadly-sin/ 😅

😂 2
frozenlock23:07:02

The author suggests using alternatives, but is there always one? For example, what if I want to use destructure to "lazily" take a few items on a potentially very large collection:

(let [[doc1 doc2] (fetch-all-the-docs!)]
  ...)
Is there a non-lazy solution?

phronmophobic23:07:38

It kind of depends on what you mean by "lazy". There are multiple options with different trade-offs: • lazy seqs via the 3+ arity sequence functions like filter, map, etc • lazy seqs via sequence • laziness via eduction • A non-lazy approach is for fetch-all-the-docs! to accept a transducer • and more!

phill23:07:33

Laziness is super! Embrace it when its characteristics serve your purposes.

frozenlock23:07:39

@U7RJTCH6J I don't think transducers would work, as I want to use it as shown in the example above. As for the multiple kinds of lazyness, I'm pretty unfamiliar with them. Usually I just have to mentally keep track of what is lazy and what is not. 😕

phronmophobic23:07:27

Transducers can help here:

(let [[doc1 doc2] (fetch-all-the-docs! (take 2))]
  ...)
It is slightly more verbose and redundant, but can useful depending on the use case. Not saying it's always the right option, but there are tradeoffs.

phronmophobic23:07:55

Personally, I usually tend to prefer the option that iteration takes which is to return a seqable/reducible .

Alex Miller (Clojure team)00:07:04

the destructuring itself is not necessarily lazy, it uses nth

Alex Miller (Clojure team)00:07:11

so it kind of depends here what fetch-all-the-docs! does. I'm not sure what your goal here actually is. destructuring is going to force the first two elements to exist. are you worried about realizing more than two items?

frozenlock00:07:16

Yes. I don't want to fetch 10k+ items when I really just need 2 or 3. It looked like lazyness was a perfect fit for this.

Alex Miller (Clojure team)01:07:36

Destructuring by itself won’t have this issue

frozenlock01:07:14

I'm not worried that destructuring will cause any problem, I'm simply interested in a way where I can use destructuring without repeating myself in the function. For example, DB APIs will often have a :limit field.

(let [[d1 d2] (fetch ... :limit 2))
It's a little inconvenient to add :limit 2 , as the destructuring is already implicitly saying that we're not interested in the 300th documents.

didibus02:07:53

Well, with the caveat that Clojure's laziness is 32 element at a time, so you'd be fetching in chunks. The alternatives are iterator and generators, and the likes.

oyakushev05:07:27

The article describes multiple reasons why a lazy (fetch-all-the-docs!) can be a bad idea: • Does it open an external resource? If so, do you properly close it in the face of deferred execution? • Does it fetch documents 1by1 or 32 at a time? Is that OK for you? • Have you established proper error-handling constructs either around let or inside fetch-all-the-docs! (but in the proper places)?

👍 2
oyakushev05:07:09

> It looked like lazyness was a perfect fit for this. > In a perfect world, yes, it is the most elegant. But when you start to look at practical side, having :limit n might in the end be a better options, all things considered. Either that, or other approaches suggested above (accepting a transducer, returning an eduction instead of a lazy sequence). Note that the eduction approach might still have the same problems with resource management and error handling.