in reply to Re^4: Create JSON patch
in thread Create JSON patch

I agree but

> it should not be impossible

Not many things are really fully impossible, but from my experience freedom of interpretation is a really bad start for a question and subsequent algorithm.

Especially if "possibility" must be bought with runtime overhead.

edit

This has the smell of NP completeness. *

Cheers Rolf
(addicted to the Perl Programming Language and ☆☆☆☆ :)
Je suis Charlie!

update

*) reminds me of Subgraph_isomorphism_problem

Replies are listed 'Best First'.
Re^6: Create JSON patch (updated)
by afoken (Chancellor) on Oct 07, 2017 at 14:39 UTC
    This has the smell of NP completeness.

    May be, I didn't (and won't) spend much time considering.

    To solve the basic problem of creating any patch for a pair of random JSON documents, a quite relatively simple-minded diff-style algorithm should do the job. Very likely, the patch won't be the smallest possible patch in all cases, and it won't be elegant at all. But that approach has proven to work quite well for the last 43 years for all kind of text files, and especially for source code.

    Alexander

    --
    Today I will gladly share my knowledge and experience, for there are no sweeter words than "I told you so". ;-)
      > work quite well for the last 43 years for all kind of text files, and ...

      text-diff / patch support "move" operations?

      I don't think so, that's why I asked the OP for clarification, what his "basic" problem is.

      We are comparing apples with gala dinners, the OP must be clearer about what kind of pony he wants.

      Cheers Rolf
      (addicted to the Perl Programming Language and ☆☆☆☆ :)
      Je suis Charlie!

        > work quite well for the last 43 years for all kind of text files, and ...

        text-diff / patch support "move" operations?

        No. Did I write that anywhere?

        Alexander

        --
        Today I will gladly share my knowledge and experience, for there are no sweeter words than "I told you so". ;-)