Giter VIP home page Giter VIP logo

diff's People

Contributors

andreasabel avatar bodigrim avatar ddssff avatar jpmoresmau avatar kcharter avatar sclv avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

diff's Issues

Fix space complexity in the docs

-- This is an implementation of the O(ND) diff algorithm as described in
-- \"An O(ND) Difference Algorithm and Its Variations (1986)\"
-- <http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.4.6927>. It is O(mn) in space.
-- The algorithm is the same one used by standared Unix diff.

The space complexity used to be O(mn) in Diff-0.1.*, but since Diff-0.2 is at most O(max(m,n)).

Upd.: Actually, maybe my mental model of snakes is wrong? I imagine that they share initial segments, but even if they don't at all, the absolutely worst case is O(n d), where d is a number of differences, which is still much better than O(m n).

Tests fail for --test-seed=-8336481659523868200

Diff> test (suite: diff-tests, args: --test-seed=-8336481659523868200)
                  
sub props:
  empty in subs: [OK, passed 100 tests]
  self in subs: [OK, passed 100 tests]
  count subs: [OK, passed 100 tests]
  every sub is a sub: [OK, passed 100 tests]
  sub prop: [OK, passed 100 tests]
diff props:
  lcsEmpty: [OK, passed 100 tests]
  lcsSelf: [OK, passed 100 tests]
  lcsBoth: [OK, passed 100 tests]
  recover first: [OK, passed 100 tests]
  recover second: [OK, passed 100 tests]
  lcs: [OK, passed 100 tests]
output props:
  self generates empty: [OK, passed 100 tests]
  compare random with diff: [Failed]
*** Failed! Falsified (after 87 tests):
DiffInput {diLeft = ["1","2","3","4","","5","6","7"], diRight = ["1","2","3","q","b","u","l","","XXX6",""]}
(used seed -8336481659523868200)
  test parse: [OK, passed 100 tests]
  test context: [OK, passed 1 tests]

         Properties  Total 
 Passed  14          14    
 Failed  1           1     
 Total   15          15   

Add Bifunctor instance for PolyDiff

The following Bifunctor instance would be very handy:

instance Bifunctor PolyDiff where
  bimap f _ (First a) = First (f a)
  bimap _ g (Second b) = Second (g b)
  bimap f g (Both a b) = Both (f a) (g b)

I appreciate supporting base >= 3 && <= 6 makes things slightly more complicated, as Bifunctor is only available since base-4.8.0.0. The two options I can think of are using a CPP macro, or increasing the minimum bounds of base.

I'm happy to open a PR with either approach (or something else!).

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.