{"id":15010661,"url":"https://github.com/green-coder/diffuse","last_synced_at":"2025-07-18T18:35:10.862Z","repository":{"id":50753523,"uuid":"285054051","full_name":"green-coder/diffuse","owner":"green-coder","description":"Diffuse is a library to create, use and manipulate diffs, to build the change you wish to see in your data.","archived":false,"fork":false,"pushed_at":"2024-07-23T18:18:23.000Z","size":69,"stargazers_count":49,"open_issues_count":3,"forks_count":0,"subscribers_count":7,"default_branch":"made-in-taiwan","last_synced_at":"2025-07-14T15:52:39.489Z","etag":null,"topics":["clojure","clojurescript","data-structures","diff"],"latest_commit_sha":null,"homepage":"","language":"Clojure","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"epl-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/green-coder.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-08-04T17:39:02.000Z","updated_at":"2025-02-20T22:24:37.000Z","dependencies_parsed_at":"2024-07-23T21:30:25.497Z","dependency_job_id":null,"html_url":"https://github.com/green-coder/diffuse","commit_stats":{"total_commits":14,"total_committers":2,"mean_commits":7.0,"dds":0.0714285714285714,"last_synced_commit":"22675d1c586dcb6204f01836ce6fe63b1db2a5aa"},"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"purl":"pkg:github/green-coder/diffuse","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/green-coder%2Fdiffuse","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/green-coder%2Fdiffuse/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/green-coder%2Fdiffuse/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/green-coder%2Fdiffuse/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/green-coder","download_url":"https://codeload.github.com/green-coder/diffuse/tar.gz/refs/heads/made-in-taiwan","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/green-coder%2Fdiffuse/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":265810207,"owners_count":23831947,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["clojure","clojurescript","data-structures","diff"],"created_at":"2024-09-24T19:35:14.743Z","updated_at":"2025-07-18T18:35:10.835Z","avatar_url":"https://github.com/green-coder.png","language":"Clojure","funding_links":[],"categories":[],"sub_categories":[],"readme":"## Diffuse\n[![CircleCI](https://circleci.com/gh/green-coder/diffuse.svg?style=shield)](https://circleci.com/gh/green-coder/diffuse)\n[![Clojars Project](https://img.shields.io/clojars/v/diffuse.svg)](https://clojars.org/diffuse)\n[![Cljdoc](https://cljdoc.org/badge/diffuse/diffuse)](https://cljdoc.org/d/diffuse/diffuse/CURRENT)\n[![Downloads](https://img.shields.io/clojars/dt/diffuse?color=opal)](https://clojars.org/diffuse)\n\n\u003e “We but mirror the world. All the tendencies present in the\n\u003e outer world are to be found in the world of our body.\n\u003e If we could change ourselves, the tendencies in the world would also change.\n\u003e As a man changes his own nature, so does the attitude of the world\n\u003e change towards him. This is the divine mystery supreme.\n\u003e A wonderful thing it is and the source of our happiness.\n\u003e We need not wait to see what others do.”\n\u003e\n\u003e – Mahatma Gandhi\n\nDiffuse is a library to create, use and manipulate diffs,\nto build the change you wish to see in your data.\n\n### Usage\n\n#### Create diffs\n\nDiffs are pure data. You can create them via some helper functions or write them directly.\n\n```clojure\n(require '[diffuse.helper :as h])\n\n(h/map-assoc\n  :foo \"hello\"\n  :bar [1 2 3])\n;=\u003e {:type :map\n;    :key-op {:foo [:assoc \"hello\"]\n;             :bar [:assoc [1 2 3]]}}\n\n(h/map-update\n  :who/members (h/set-conj :country/taiwan))\n;=\u003e {:type :map\n;    :key-op {:who/members [:update {:type :set\n;                                    :conj #{:country/taiwan}}]}}\n```\n\n#### Operate on diffs\n\n```clojure\n(require '[diffuse.core :as d])\n\n;; Combine diffs together to get a new diff.\n(d/comp-diff diff-1 diff-2)\n\n;; Apply a diff to get an updated data.\n(d/apply-diff data diff)\n```\n\n#### Example\n\nOn sets:\n\n```clojure\n(d/apply-diff #{:pam :poum}\n              (d/comp-diff (h/set-disj :pam)\n                           (h/set-conj :pim)))\n;=\u003e #{:pim :poum}\n```\n\nOn maps:\n\n```clojure\n(d/apply-diff {:a 2, :c #{1}, :d 4}\n              (d/comp-diff (h/map-dissoc :d)\n                           (h/map-update :c (h/set-conj 2))\n                           (h/map-assoc :a 1, :b 2)))\n;=\u003e {:a 1, :b 2, :c #{1 2}}\n```\n\nOn vectors:\n\n```clojure\n;; With diffuse, you can correct the ISO 3166 which is plainly wrong.\n;; https://www.change.org/p/iso-change-the-present-taiwan-province-of-china-to-taiwan-4\n(d/apply-diff '[Taiwan province of China])\n              (h/vec-remove 1 3))\n;=\u003e [Taiwan]\n\n;; You can also correct it with true official information, regardless of how confusing it can be.\n(d/apply-diff '[Taiwan province of China]\n              (h/vec-assoc 1 'Republic))\n;=\u003e [Taiwan Republic of China]\n\n;; You can also declare your love for Taiwan.\n(d/apply-diff '[Taiwan province of China]\n              (h/vec-remsert 1 3 '[number 1 !!!]))\n;=\u003e [Taiwan number 1 !!!]\n\n;; You can also use it to promote the best beer of Taiwan.\n(d/apply-diff '[Taiwan province of China]\n               (d/comp-diff (h/vec-remove 1 3)\n                            (h/vec-insert 1 '[number 1 !!!])\n                            (h/vec-insert 1 '[Beer])))\n;=\u003e [Taiwan Beer number 1 !!!]\n```\n\n### Use cases\n\nYou certainly wonder why this library was built, that's understandable.\nSometimes things exist, are beautiful, and still don't make sense. That's how it is.\nIf you really want to find an answer to your question, ask deep inside yourself ... why ??\n\nPlease open an issue if you find an answer, sharing is caring.\n\n### Other diff libraries\n\nThe focus of Diffuse is to:\n- manually build a representation of data structure differences,\n- compose them together,\n- and apply them on data (this action is also known as \"patching\").\n\nYou use Diffuse when you know the difference and want to use it,\nhence the name \"diff ... use\".\n\nOn the opposite, When you have 2 versions of a data structure and\nyou don't know their difference, you can calculate it via one of\nthose libraries:\n\n- [deep-diff2](https://github.com/lambdaisland/deep-diff2)\n- [Editscript](https://github.com/juji-io/editscript), whose\n  author wrote the very useful blogpost\n  \"[Comparing Clojure Diff Libraries](https://juji.io/blog/comparing-clojure-diff-libraries/)\".\n\n### Status\n\nAlpha quality, lack of error messages, tested, no known bug, usable.\n\nNote: While still in alpha, the API and data format may change.\n\n### License\n\nThe Diffuse library is developed by Vincent Cantin.\nIt is distributed under the terms of the Eclipse Public License version 2.0.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgreen-coder%2Fdiffuse","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgreen-coder%2Fdiffuse","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgreen-coder%2Fdiffuse/lists"}