Fork me on GitHub

I am trying to motivate some coworkers to try out Clojure. I am looking for some example codes that are way smaller in Clojure than say Java/C#. Better if the code does something useful and not just a toy example. What can you think of?

gklijs05:01:53 has the functionally same GraphQL endpoint in multiple languages / frameworks. Smaller is not always better through, you could argue the Java code is better maintanable.

👍 2

Thanks, will take a look.


At such a level it's a bit hard to compare through. As some of the code can be replaced by using an additional dependency in some cases, and more things like that.


I made a fun little demo of live coding and java interop. The code isn't super clean. But I was trying to show how to use a java delay queue. And how you can use the repl to test out various scenarios to prove to yourself that things work the way you expect. Basically, you can start up multiple workers. Then they are "hitting a remote service" (mocked as an atom). You can take the service down, watch as things get delayed, bring the service back up and watch as requests start going through. Code isn't organized cause it was the result of a live demo. But I've found that sort of demonstration to be very useful.

👍 1

Thanks for this. This is very real worldish, exactly what I had in mind. I will go through it. And I'm sure it was a cool demo!


all of them?

😛 2

True, 😀. But if someone took the time to write the same thing in Clojure and some other languages, perhaps a blog post, that will we great for showcasing.


you could always pull stuff from


but those are toys


Some of them are more or less serious, like (albeit, it's a toy in a different sense)

👍 1

Interesting, will take a look. This reminds me... My manager is open to new languages (teammates are not). I showed a Sudoku solver to him and he got impressed by the terseness.


Send him also a few links to Paul Graham's Lisp-related essays. :)


Yes, those are great. Beautiful Racket also has a great chapter on the power of LISP.


is fewer lines really going to convince them?


It might not convince them to switch primary development languages, on its own, but it might convince them to look further.


To get them interested. Without some serious examples, we will never move past the "oh, it's a LISP" stage.


So far, I have convinced one of them to take a look at the SICP book.


I suppose, but I guess my experience colors my response here. I didn't have much luck convincing people with terseness


You may be right. But terseness is a big attraction for me personally.


The famous Rich Hickey talks are what sold me (Simple Made Easy, Are We There Yet, etc)


Yes, but honestly, they are not easy to get the first time. And people with preconceived notions of LISP weirdness won't have the patience.


I am not saying that this will convince anyone, but Rich has a few sentence in an early "Clojure for Java programmers" talk that tries to address this, very briefly: "I do not see a lot of people who know Lisp here, but that does not mean there is not a bias against Lisps. I mean, how many people have seen Lisps and said: Oh, my god! Ugh! I cannot believe the parentheses. And I would say: I would hope you put that bias aside for the purposes of this talk. It ends up that for people who have not used Lisp, those biases have no basis, and for most people who have given it a solid try, they vanish. And in fact, many of the things that you consider to be problems with Lisp are features, down the line. But having said that, Clojure is a very different Lisp. It is syntactically much leaner than a lot of Lisps. It has fewer parentheses. It uses more data structures in its syntax, and as a result, I think is more succinct and more readable. So it may be the time to try Lisp again."


If someone truly has a knee-jerk reaction to certain aspects of things, e.g. loves to get in long drawn out arguments on the fine points of vi vs. emacs (or worse, stick to surface-level details), they may not yet be at the point of looking past surface-level aspects yet.


I find the most convincing thing that Clojure offers is the REPL -- because it is not like "REPL" in other languages.


That you can inspect (and modify) a live, running application from your editor.


@hindol.adhya I’d make a PoC that’s work related - perhaps automating some annoying process, showcasing the repl by investigating a bug or the shape of your data. Showcasing finished code to people who can’t read it rarely helps.


Been there, done that. Problem is, since it was real work, it became non-trivial and spanned 6/7 files and used Pedestal. I felt the sweet spot is something simpler, maybe a single file with a few hundred lines that is also easy to understand.


I found that generating Excel reports with Clojure is stupidly simple, almost like pseudocode.


Tie it in with some fetching of external resources (e.g. JSON) and it also becomes a breeze.


This integration of REPL and editors is indeed one of the killer features of Clojure IMHO.

👍 1

It changes the way I think about code a lot. Even if you already know the function you're using, having the documentation / source just a keystroke away can give you insights about better ways, unknown arities, etc 🙂


But not without cost. Keeping your system repl driven has an overhead. Keeping my repl integrated into my editor tends to mean it crashes a bit more. I agree its amazing and worth the cost though.

Michael J Dorian18:01:43

What kind of crashes do you experience from that?


YMMV when i eval something huge in emacs it might fall over. It's getting better all the time though.

Michael J Dorian18:01:37

Interesting. I don't have that problem with vim-fireplace but my hobby game is also not huge


@drewverlee I'd say that's a bug in whatever REPL integration you're using 🙂


huge things in emacs aren't fun in general, REPL or not


I sometimes accidentally open a huge .xml file. I'd better just kill the emacs process rightaway


extremely long lines are the emacs killer


pretty sure that's because of syntax highlighting


Yes. And the workaround is to disable font locking for the whole file if there's a single long line.


do you know how to conditionally do that?


like if there's any line over X chars long then disable this


There's a package for that. Let me find it.


I want to know too


cooool, thanks!


This disables the language specific major mode entirely so there goes IDE like features and syntax highlighting. Bottom line is, don't use long lines in code. so-long.el is very useful for log files and other data files though.


hmm, I get (file-error "" "Not found") when trying to install quelpa...


Maybe try M-x package-install? I am on my phone right now but I can try that later. Previously I used it along with Doom Emacs without issues.


Tried that yes. Maybe melpa is having issues

Cora19:01:40 -- a mirror from the maintainer of doom emacs


Sorry for being off topic in #off-topic, but I just misread #hochiminhcity as #homoiconicity on Insta. What has happened to me?


Services for mailing lists. Looking at this for the first time (Mailchimp, sendinblue etc.). Anyone use these? Are people using this with their own landing pages and using these services API's, or do some of these services provide fully blown hosting/database/smtp?


we use sendgrid for transactional emails via their api


but haven't used it for mailing list/marketing type emails


also using sendgrid in an app I'm working on


Thanks, I'll have a look


Any nice coding / software / programming languages podcasts I should listen to? I listen to pretty much every Clojure podcast, also Linux action news, CoRecursive, functional geekery... but somehow for the last few weeks the stream dried up.


I find InfoQ podcast, CaSe (Conversations about Software Engineering) and Software Engineering Radio good. Also Eric Normand's Thoughts on Functional Programming if that's not already on your list.


@U04V15CAJ how do you find time for everything 😲


@UQ4QVMYV8 I listen to those while working out or vacuum cleaning, that doesn’t take extra time


Thanks jumar


thanks, I subscribed


Not coding, I can't help but also suggest the glass cannon podcast. Endless hours of content. Wonderful pathfinder actual play podcast.


Cognicast coming back soon!

parens 12
parrot 12

Looking forward to it