Developer Scratch Pad
Interesting situation in clojure

So I was trying to do something like this:

(defn bad-function [body]

(let [result “hello”]

body))

And then I tried to do something like this:

(bad-function (println result))

And it failed. I didn’t understand why it would failed since I do something very similar in our regular non-lisp languages.

I don’t fully understand what is the problem, but this is my guess: when the reader begins to apply (bad-function (println result)), it wants to apply the body at some point before the result binding happens.

I believe that if I am going to be able to do something like that, I am going to have to use macros.

I would like to know what exactly is going on though.