Skip to content
This repository has been archived by the owner on Nov 10, 2021. It is now read-only.
/ shallow-diff Public archive

Shallow Diff in Clojure, inspired by immutable-diff

Notifications You must be signed in to change notification settings

Cumulo/shallow-diff

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Shallow Diff

A simplified diff/patch solution learning from immutable-diff/patch.

Values are compared with identical? for performace in special scenarios. There's still much room for optimizations in vector diffing.

Usage

[cumulo/shallow-diff "0.1.3"]
(shallow-diff.diff/diff x1 x2)
(shallow-diff.patch/patch x1 operations)

Only hash-map, hash-set, vector are supported. For other types of primitives, it generates set! to replace.

Operations

Format [coord [op arg1 args2]], examples:

[[1   ]  [:add     2  "x"]]

[[:map]  [:remove  1     ]]

For values:

[:set! a-val]

For hash maps:

[:add  a-key a-val]

[:drop a-key      ]

For vectors:

[:insert a-key a-val]

[:remove a-key      ]

[:append a-val      ]

For hash sets:

[:include a-val]

[:exclude a-val]

Test

lumo -Kc $boot_deps:src/ -i test/diff.cljs
lumo -Kc $boot_deps:src/ -i test/patch.cljs
lumo -Kc $boot_deps:src/ -i test/round_trip.cljs

Develop

https://github.com/mvc-works/stack-workflow

License

MIT

About

Shallow Diff in Clojure, inspired by immutable-diff

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published