this post was submitted on 19 May 2025
1 points (100.0% liked)

Clojure programming language discussion

555 readers
1 users here now

Clojure is a Lisp that targets JVM and JS runtimes

Finding information about Clojure

API Reference

Clojure Guides

Practice Problems

Interactive Problems

Clojure Videos

The Clojure Community

Clojure Books

Tools & Libraries

Clojure Editors

Web Platforms

founded 5 years ago
MODERATORS
 

Consistent code style for Clojure function definitions

https://www.emcken.dk/programming/2025/05/11/clojure-function-definitions/

A Clojure function is often defined with name and arguments on a single line: (defn some-function [with-several arguments] ... and the following post is about why I will advocate for a multi-line alternative: (defn some-function [with...

#clojure #clj #cljs !clojure@lemmy.ml @clojure

you are viewing a single comment's thread
view the rest of the comments
[โ€“] acron@lemmy.ml 1 points 3 days ago* (last edited 3 days ago)

It's always irked me that we operate on "text" files as the basis for software development, rather than some symbolic representation of the code. If I have my preference about layout, and you have yours, why do we have to pick one? We aren't forced to choose other aesthetics like colour scheme or font, so why layout? Why tabs vs spaces? Why single-line or multi-line? The compiler doesn't care, it only cares about the symbols.

I guess you can kind of work around this by, for example, having inbound source code files formatted automatically (e.g. eslint) into your style and then have an outbound file also formatted into the style of whatever the project mandates (assuming they're different), but this is a bit ick.