Fork me on GitHub
#off-topic
<
2020-01-31
>
hindol04:01:06

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

https://github.com/openweb-nl/kafka-graphql-examples 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.

๐Ÿ‘ 8
hindol05:01:55

Thanks, will take a look.

gklijs06:01:49

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.

Jimmy Miller14:01:34

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. https://github.com/jimmyhmiller/PlayGround/blob/418feee0bfe018b77063b6344451039c76ea062f/blocking-queue/src/blocking_queue/core.clj 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.

๐Ÿ‘ 4
hindol20:01:29

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!

Alex Miller (Clojure team)04:01:57

all of them?

๐Ÿ˜› 8
hindol04:01:46

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.

deleted04:01:51

but those are toys

p-himik04:01:56

Some of them are more or less serious, like http://rosettacode.org/wiki/2048 (albeit, it's a toy in a different sense)

๐Ÿ‘ 4
hindol05:01:05

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.

p-himik05:01:29

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

hindol20:01:27

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

deleted04:01:05

is fewer lines really going to convince them?

โž• 4
andy.fingerhut04:01:13

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

hindol04:01:42

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

hindol04:01:29

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

hindol05:01:20

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

chepprey15:01:20

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

hindol19:01:58

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.

andy.fingerhut20:01:35

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

andy.fingerhut20:01:01

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.

seancorfield05:01:24

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

seancorfield05:01:16

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

orestis08:01:46

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

hindol08:01:15

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.

orestis08:01:02

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

orestis08:01:09

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

mauricio.szabo14:01:41

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

๐Ÿ‘ 4
mauricio.szabo14:01:07

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 ๐Ÿ™‚

Drew Verlee18:01:15

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?

Drew Verlee18:01:32

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

seancorfield18:01:54

@drewverlee I'd say that's a bug in whatever REPL integration you're using ๐Ÿ™‚

borkdude18:01:11

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

borkdude18:01:33

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

deleted18:01:56

pretty sure that's because of syntax highlighting

hindol19:01:33

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

hindol19:01:20

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

borkdude19:01:26

I want to know too

hindol19:01:01

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.

borkdude19:01:42

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

hindol19:01:21

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.

borkdude19:01:34

Tried that yes. Maybe melpa is having issues

hindol19:01:33

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

hindol20:01:54

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

Gulli20:01:54

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?

nickmbailey20:01:54

we use sendgrid for transactional emails via their api

nickmbailey20:01:09

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

borkdude20:01:30

also using sendgrid in an app I'm working on

Gulli20:01:12

Thanks, I'll have a look

borkdude22:01:45

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.

jumar05:02:29

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.

Hi07:02:52

@U04V15CAJ how do you find time for everything ๐Ÿ˜ฒ

borkdude08:02:51

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

borkdude08:02:39

Thanks jumar

borkdude19:02:44

thanks, I subscribed

Jimmy Miller19:02:34

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

Alex Miller (Clojure team)22:01:42

Cognicast coming back soon!

parens 48
parrot 48
20
borkdude22:01:30

Looking forward to it

โž• 8