Fork me on GitHub
Jim Newton08:03:42

There is a clojure core function group-by, but in some other functional languages there are several cousins of this available. I wonder if these already exist in clojure core by some other name, or whether I need to implement them myself, which of course is not very difficult to do. group-by groups the elements of the input collection according to some probe function. However, sometimes we don't want to group the inputs, but group some transform of the inputs. For example given a collection of (x,y) pairs, we might want to group the y's by x value. (group-by first coll) if coll is a collection of pairs, this group-by will collect the pars. (group-map first second coll) would group the y's by x value. and (group-map-reduce first second 0 +) would group by x value but add up the y's rather than collecting them, hopefully without actually constructing the intermediate collection of y values. As I said, it is easy to implement these functions, but just want to check whether there are already these functions which I should use.


There's nothing like that I know about. You can scan pretty quickly. In general, this is very much unnecessary since as you say they are easy to implement.


You asked pretty much the same question just a few days ago, no?

Jim Newton09:03:53

I think you’re right. I’m maintaining three code bases, Python, Clojure, and Scala. And I’m losing track of what is pending where.

Jim Newton09:03:41

I remember fixing things somewhere, but I’m getting confused about where is what.


Have you seen the xforms library's by-key It can handle all these cases

Jim Newton13:03:02

it is interesting to me that in a dynamically typed language like clojure the user can implement group-map and group-map-reduce himself in just a few lines. This is extemely difficult and brittle in a language like Scala, where it can be done for a particular type, but cannot easily be done for a open set of types. I tried this some time back, to implement an alternative strategy of fold-left. It was no end of trouble and arguments amongst experts. It worked until I found a new case, then someone proposed a fix, then it worked until the next class came along. Plus the it was a migration nightmare. When upgrading to the next Scala version, functions I had used were now deprecated, and I had to fix code I didn't understand (as they had been suggestions of various experts).


> When upgrading to the next Scala version, functions I had used were now deprecated, and I had to fix code I didn't understand Seems like it has always been like that with Scala - exactly why I personally can't consider it for anything beyond a toy project.

Jim Newton14:03:34

I think it was Bjarne Stroustrup who said there are two kinds of programming languages. 1. the kind people complain about, and 2. the kind people don't use

Jim Newton14:03:20

for me it is interesting to try to understand different language approaches. my interest is academia anyway.

Jim Newton14:03:09

Earlier in my career, I created professional software, so i know the problem of trying to fix bugs in software, not knowing whether my customers depended on those bugs.

Jim Newton14:03:06

In scala, it seems like several times they've taken what they'd learned from user experience and tried to re-incorporate this back into the next language version. of course that is disruptive.


I think Bjarne Stroustrup's comment sounds like it could be attempting to brush away real concerns here. One could take it as "well, C++ is actually used by people, so of course they will complain about it more than languages they don't use".

😃 2
👍 1

But taken in a bad light, such a comment could be used by someone to attempt to dismiss legitimate complaints about too much complexity or sharp corner cases that a programming language encourages or promotes, which I think is fair to say that C++ does.


Even people who love Clojure and use it a lot have complaints about it, certainly. But the kinds of complaints are very different. I would guess (but have no data to back it up) that number of complaints per hour of use by professional developers is far lower for Clojure than C++.


Bjarne also said, "if C lets you shoot yourself in the foot, C++ lets you blow your whole leg off". He's quite pragmatic about C++'s flaws (perceived and real) 🙂


(I was on the ANSI C++ committee for eight years so I got to hear quite a few of these things 🙂 )


There are some classics in that list 🙂

Shuky Badeer09:03:21

Hi guys! I'm using Datomic with clojure, and I was wondering if there's a way to visualize the Datomic db? Something like DBeaver but for datomic?


the REPL maybe? :thinking_face: jokes aside ) there is REBL from cognitect -

👍 1

There are also open-source alternatives for REBL, like Reveal and Portal.

👍 2
Shuky Badeer09:03:30

@U04V4KLKC thanks for the tip!

Shuky Badeer09:03:58

@U2FRKM4TW any chance you can provide a link for reveal and portal so that i can look into them? The hardship i find in the clojure ecosystem is that google doesn't always help finding stuff


FWIW for me the top links are the right results, even in incognito (looked up "clojure reveal" and "clojure portal" without quotes): •

Ferdinand Beyer09:03:55

Thinks you asked for dbeaver — datomic comes with a console that provides you a web UI to run queries and examine entities — is that what you meant?

Shuky Badeer09:03:13

@U2FRKM4TW oh my apologies i rather looked up "datomic reveal" cuz what i wanted for was a GUI like dbeaver + i'm kinda new to the whole clojure thing tbh.

Shuky Badeer09:03:33

@U031CHTGX1T yessss i was looking for a DBeaver GUI equivalent

Ferdinand Beyer09:03:48

Then check out the console! 🙂

Shuky Badeer10:03:14

@U031CHTGX1T am i wrong in thinking this is meant for on-premise datomic server? The bin/console command made me think so as it's not recognized and the datomic db in this case is an ec2 instance

Shuky Badeer10:03:39

And a general question if you don't mind, is it better to use Linux for clojure/Datmic? I'm currently on windows

Ferdinand Beyer10:03:56

I only played with datomic locally, so I am not an expert on that. I think there should be a way to hook the console up with a datomic transactor running on AWS

👍 1
Ferdinand Beyer10:03:48

> And a general question if you don’t mind, is it better to use Linux for clojure/Datmic? I’m currently on windows That’s a matter of taste. I prefer macOS, others Linux, and I know Clojure devs who use windows and are very happy with that 🤷

👍 1
Shuky Badeer11:03:02

@U031CHTGX1T Thank you so much! Knowing i'm a member of such an amazing lil community is definitely encouraging!

Ferdinand Beyer11:03:39

Glad to hear that! Let’s keep it up together 🙂

Alex Miller (Clojure team)15:03:59

I was surprised to see in the survey results so far how many people are already using Clojure 1.11, which is not even GA yet! Pretty cool

👍 3
Ferdinand Beyer16:03:46

I wonder if people argue: We are already using spec alpha and tools alpha, can just as well use Clojure alpha


I suspect it is also a long history of new Clojure versions adding new features, and fixing bugs, but not breaking existing widely-used behavior.


To get an idea of scale, can you say roughly how many responses you've had so far @U064X3EF3?


@U031CHTGX1T Clojure's stability is what allows this: we've been using alpha builds of Clojure in production as they appear, dating back to Clojure 1.3 alphas, nearly 11 years ago! 🙂

Alex Miller (Clojure team)16:03:46

we're about half of last year's total responses at this point. first few days were much stronger response than last year (2-3x), not sure if that will be reflected in the total or if I just did a better job promoting it :)


Or Clojure is just taking over the world, finally ;)

😍 4

Doesn't it suggest that word of the survey spreads first (or... mainly?) to the same people who are most likely to be aware of the new version? Reporting the Maven download proportions juxtaposed with the survey answers would be interesting although not necessarily enlightening.

Alex Miller (Clojure team)17:03:19

I don't think we've seen similar results in past years when survey coincided with a new release

Alex Miller (Clojure team)17:03:36

But that's something I could look at

Alex Miller (Clojure team)17:03:22

Maven download numbers are pretty noisy but might be interesting to compare, haven't looked at that

Jim Newton17:03:37

I don't know which version I'm using. just took the lastest a few days ago.


@U010VP3UY9X Do you mean the latest Clojure CLI? -- so that uses Clojure 1.10.3 by default, but your project deps.edn can specify any version of Clojure you want, from way back at 1.0.0 right up the nightly master snapshot. See my user deps.edn file:

Jim Newton09:03:29

ahh, then i probably answered wrong in the survey. Perhaps there should have been a choice (in the survey question) “I don’t know which version I’m using, but I’m happy nonetheless”