beginners

amiorin 2025-10-29T08:25:50.836839Z

TIL: C-c C-c works with #_(+ 1 1) I was watching https://www.youtube.com/live/kGOB9IPKHfo?si=l3a2FuDsSGamd9Ha&t=394 and @neumann was showing his setup. I used to use (comment ...) but this is better IMO. 🎉

p-himik 2025-10-29T08:27:36.143159Z

> this is better IMO Only for single forms. Because you have to add it in front of each form. Or use #_#_#_ with the number of #_ being equal to the number of forms you want to comment out. :)

💡 1
amiorin 2025-10-29T08:28:33.413719Z

Indeed.

dpsutton 2025-10-29T13:27:00.665839Z

if in emacs, there’s a way to make all of that stuff work with comment forms: https://github.com/clojure-emacs/clojure-mode/blob/master/clojure-mode.el#L2365-L2372

dpsutton 2025-10-29T13:27:22.507979Z

then the “top level” type functions will ignore the comment form and treat the first level forms as top level there

amiorin 2025-10-29T13:59:40.560689Z

@dpsutton I didn't know. It looks promising.

dpsutton 2025-10-29T14:01:48.721629Z

it’s deeply ingrained in my workflow now. enjoy it!

2025-10-29T14:21:31.069639Z

I use #_ instead of comment. It works better for me.

2025-10-29T14:22:41.805969Z

Because it can be used like shown here, for precise inner disablement, or you can wrap it around a big thing similar to comment but it's shorter

neumann 2025-10-29T18:17:13.058839Z

I use both #_ and comment. If I just have a few items, I tend to use the ignore next form (`#_) for each item. If I have a group of items, I tend to use comment`. I really like both of them.

neumann 2025-10-29T18:17:57.804489Z

As @didibus mentioned, you can use ignore in the middle of things, and that is really useful too.

dpsutton 2025-10-29T18:18:19.398459Z

yes didn’t want to say #_ has no place. use it quite a bit. and its distinct from comment for my purposes. i just wanted to highlight that C-c C-c and friends work with the comment macro with a tweak as that seemed to be what was so compelling about the reader discard version

neumann 2025-10-29T18:24:08.727959Z

For example, I was working on a regex, and I cranked out a few different test cases as I was writing the function. I just co-located them like so:

(def comment-re #"^\s*;.*")

#_(re-matches comment-re "; test")
#_(re-matches comment-re " ; test")
#_(re-matches comment-re " ;test")
Those turn into tests later on, but it was quick to just add them right under the definition as a quick sanity check for what I was doing. I started with one, so I used #_, and then I copied and pasted that line a couple times and modified it.

dpsutton 2025-10-29T18:26:26.766789Z

ha. i do that but with a single comment form and not 3. but same workflow

neumann 2025-10-29T18:27:45.244519Z

For some reason, when I have a "process", I tend to use a comment block. Eg.

(defn start-server
  [config]
  (jetty/run-jetty (app config) {:port (:dev/port config) :join? false}))

(comment
  (def server (start-server (config)))
  (.stop server)
  (.start server))

➕ 1
dpsutton 2025-10-29T18:28:19.722789Z

i have a keybinding to create a comment block after the top level form i’m in so that drives my usage quite a bit

neumann 2025-10-29T18:28:23.161949Z

The more related things I put together, the more likely I am to use a comment block, but a lot of my stuff starts with the ignore form.

dpsutton 2025-10-29T18:29:02.036179Z

(defun personal/insert-comment ()
  (interactive)
  (end-of-defun)
  (insert "\n")
  (insert "(comment\n  )\n")
  (clojure-backward-logical-sexp)
  (forward-char 1)
  (clojure-forward-logical-sexp)
  (insert "\n")
  (indent-according-to-mode))
and bound to C-M-i and puts my cursor right there ready to go

neumann 2025-10-29T18:29:37.103239Z

Nice!

2025-10-29T22:09:55.003189Z

You can also just do:

#_(
   (def server (start-server (config)))
   (.stop server)
   (.start server)
)
No need for comment. And what I like to do:
#_(do
  (def foo 1)
  (def bar 2)
)
Now you can eval the whole thing in one go, or each form individually.

p-himik 2025-10-30T05:00:34.433019Z

That would require either selecting the exact form or using some "eval the current form only" mechanism, which demands a great care of positioning your cursor. With (comment ...) or #_-per-form, every form is top-level, so you can just use "eval the current top-level form", which doesn't ask for any care or explicit selection.

practicalli-johnny 2025-10-30T15:09:56.280649Z

Inbgeneral Inuse the reader macro comment to help debug specific parts of existing code. I use the comment form for Repl driven development, separating experiments from code designs I have chosen to use https://practical.li/clojure/reference/clojure-syntax/comments/

👍 1
2025-10-30T15:53:04.391489Z

@p-himik You don't use structural navigation? It's pretty easy to select the correct form I find. In fact I never use the eval-top-level command because I find it redundant compared to just selecting the top level form and evaling it.

p-himik 2025-10-30T15:54:31.146739Z

Even with structural navigation, selecting a form you have just navigated to is still an extra step, isn't it?

2025-10-30T16:37:23.099189Z

You don't need to select it, just have the cursor on it. At least in Emacs.

p-himik 2025-10-30T16:39:18.788869Z

Ah, I didn't even realize Cursive also had "Send Form Before Caret to REPL".

Pedro Gusfer 2025-10-29T17:53:09.783099Z

What is your recommendation for learning web development with Clojure to create full-stack applications, given that the book "Web Development with Clojure" is outdated?

Pedro Gusfer 2025-10-29T17:57:44.889899Z

I found this article very helpful: https://www.evalapply.org/posts/clojure-web-app-from-scratch/index.html

Bob B 2025-10-29T21:34:14.425769Z

Another article with a wide variety of options is <https://clojure-doc.org/articles/ecosystem/web_development/>, although it's a bit more "here are libraries that are web/web-adjacent", but some of those libraries (e.g. Kit and Biff) will have tutorials regarding their specifics.

❤️ 1
1
regibyte 2025-10-29T22:27:19.565999Z

I’d say give the caveman guide a try https://caveman.mccue.dev/ If you already know web development, this is what you’re looking for, a guide on how to setup your project, it gives you a structure that is easy to understand, scale and reproduce later

❤️ 5
➕ 3
Pedro Gusfer 2025-10-30T00:49:01.544479Z

Thank you so much @reginaldo.junior696! That was exactly what I needed!!! (I come from Rails world)

1
❤️ 1
regibyte 2025-10-30T00:53:59.446499Z

Glad to hear bro! I was enlightened by this same guide about a month ago, just passing the word forward 🙏

➕ 1
teodorlu 2025-10-30T06:55:49.475389Z

I recommend reading https://github.com/nextjournal/calendula/ and https://github.com/nextjournal/impulse. Two Clojure files of 130 lines each, that you can understand in full. The result is a working Calendly clone with login and email (with the help of libraries). Caveman is a great introduction to "the common way of doing things", calendula / impulse asks whether maybe we can go simpler.

1
prnc 2025-10-30T11:02:32.532229Z

@teodorlu from what I understand application.garden is not publicly available yet, is that correct?

teodorlu 2025-10-30T12:14:17.512079Z

It's not yet generally available — but if you ask in #application-garden, you might very well have access before the day is over!

🙏 1
prnc 2025-10-30T13:38:50.609699Z

great, thanks!

❤️ 1