Fork me on GitHub
#calva
<
2023-08-11
>
Bhougland14:08:23

I am a noob and going through the calva training and feel like this part of the training didn't evaluate correctly. Should both comments evaluate to nil?

dpsutton14:08:35

it’s evaluating the whole form.

user=> (source comment)
(defmacro comment
  "Ignores body, yields nil"
  {:added "1.0"}
  [& body])
and the comment macro expands to nothing. It’s purpose is to be a wrapper around a bunch of forms that won’t evaluate when you require or load a file. But you can evaluate subforms in them. So (println (greet "World")) will evaluate to what you expect. But evaluating the whole (comment (println (greet "World"))) won’t do anything (by design)

dpsutton14:08:42

I think there’s a setting to indicate to Calva whether comment is toplevel, or the forms inside of it are top level and that doesn’t seem to be set correctly. There’s a #CBE668G4R channel that probably has several generous people online right now who can help you though.

Bhougland14:08:51

lol! Thank you, I am glad it was something simple

👍 1