Fork me on GitHub
#clojure
<
2022-07-24
>
Drew Verlee03:07:29

Is anyone aware of any structural diffing tools for clojure other then https://fazzone.github.io/autochrome.html?

dpsutton03:07:32

Difftastic is aware of clojure

👍 1
Drew Verlee03:07:39

i'll look into that. Last i checked it didn't easily integrate into emacs.

rolt15:08:04

https://github.com/dandavison/delta has emacs support but it's not language specific

pinkfrog16:07:52

Question on compilation (to be more precise, evaluation process). Given a file x.clj,

(ns x)

(defmacro mac
  []
  (println "asdf"))

(println "go")
(mac)
After run I
clj -M x.clj
The output is
go
asdf
Naturally this looks right. But it is said that clojure evaluation process is: 1. Read the clj file 2. Expand all the macros if possible 3. Emit bytecode for execution 4. Execute bytecode So given the above model, I’d expect “asdf” is first printed which is at phase 2, and “go” is printed later at phase 4. Obviously, this conflicts with the actual result. So my question is, what’s the right mental understanding of the clojure evaluation/compilation process.

Ben Sless16:07:39

That's because 1 is the faulty assumption. There is no real concept of file, the reader reads forms one at a time

Ben Sless16:07:16

2-4 happen for each form

Ben Sless16:07:52

so the macro mac is expanded after the bytecode for println was already evaluated

pinkfrog16:07:50

By form are you referring to top-level form?

Fredrik17:07:36

Yes, each top-level form (of which there are four in your example) is read and executed in sequence.

pinkfrog01:07:52

Thanks guys!