

Clojure and EDN diff tool
source link: https://blog.klipse.tech/clojure/2020/10/08/edn-diff.html
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

Clojure and EDN diff tool
Oct 8, 2020 • Yehonathan Sharvit
Compare recursively two Clojure data structures a
and b
.
Comparison is updated as you type…
xxxxxxxxxx
(def a {:only-in-a 1
:both-in-a-and-b 3})
the evaluation will appear here (soon)...
xxxxxxxxxx
(def b {:only-in-b 2
:both-in-a-and-b 3})
xxxxxxxxxx
the evaluation will appear here (soon)...
Full comparison:
xxxxxxxxxx
(def full-comparison (clojure.data/diff a b))
xxxxxxxxxx
the evaluation will appear here (soon)...
Things only in a
:
xxxxxxxxxx
(first full-comparison)
xxxxxxxxxx
the evaluation will appear here (soon)...
Things only in b
:
xxxxxxxxxx
(second full-comparison)
xxxxxxxxxx
the evaluation will appear here (soon)...
Things in both a
and b
:
xxxxxxxxxx
(last full-comparison)
xxxxxxxxxx
the evaluation will appear here (soon)...
Comparison rules:
- For equal
a
andb
, return[nil nil a]
. - Maps are subdiffed where keys match and values differ.
- Sets are never subdiffed.
- All sequential things are treated as associative collections by their indexes, with results returned as vectors.
- Everything else (including strings!) is treated as an atom and compared for equality.
Explore more examples on ClojureDocs.
to stay up-to-date with the coolest interactive articles around the world.
Discover more cool interactive articles about javascript, clojure[script], python, ruby, scheme, c++ and even brainfuck!
Give Klipse a Github star to express how much you appreciate Code Interactivity.
Subscribe to the Klipse newsletter:Feel free to email me [email protected] for getting practical tips and tricks in writing your first interactive blog post.
Recommend
-
39
If you’re a programmer, you’re probably fairly comfortable with understanding and interpreting diff patches of the kind that git and other version control systems use. In this post we’ll walk through a Cloju...
-
9
TL;DR: Radar built an open source tool for performing side-by-side evaluations of JSON APIs. We hope you find it useful, too. Introduction Radar engineers needed a tool for side-by-side evaluations of changes to the s...
-
30
Returning to a Better Diff Tool Apr 18, 2017 So this morning I needed to diff some fairly complex html and see the differences. This is part of a page archiver I'm building and the command: ...
-
8
EDN parser for Emacs Lisp parseedn is an Emacs Lisp library for parsing EDN data. It uses parseclj's sh...
-
16
It's Difftastic! Difftastic is an experimental structured diff tool that compares files based on their syntax. It is very much unfinished. It works reasonably on very parenthesised data (lisps, JSON), it works sometimes on oth...
-
7
Fatih Pense September 19, 2021 1 minute read ...
-
6
Use Beyond Compare as a Git Diff/Merge Tool in OS X Comments: Tags: WalkthroughTools
-
7
This is part of an ongoing series of blog posts about our ever-evolving use of the Clojure CLI, deps.edn, and Polylith, with our monorepo at
-
10
This is part of an ongoing series of blog posts about our ever-evolving use of the Clojure CLI, deps.edn, and Polylith, with our monorepo at
-
8
This is part of an ongoing series of blog posts about our ever-evolving use of the Clojure CLI, deps.edn, and Polylith, with our monorepo at
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK