Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Correct results of diff and sdiff #22

Merged
merged 3 commits into from
May 2, 2024

Conversation

antononcube
Copy link
Contributor

The original implementation does not produce results that much the outputs in the documentation. This PR fixes that.


Old version, 0.0.2

my @a = <a b c e h j l m n p>;
my @b = <b c d e f j k l m r s t>;

my $diff = diff( @a, @b );

say $diff.raku;

gives :

$(["-", 0, "a", "+", 2, "d", "-", 4, "h", "+", 4, "f", "+", 6, "k"], ["-", 8, "n", "+", 9, "r", "-", 9, "p", "+", 10, "s", "+", 11, "t"])

PR's version, 0.0.3

my @a = <a b c e h j l m n p>;
my @b = <b c d e f j k l m r s t>;

my $diff = diff( @a, @b );

say $diff.raku;

gives :

$([["-", 0, "a"], ["+", 2, "d"], ["-", 4, "h"], ["+", 4, "f"], ["+", 6, "k"]], [["-", 8, "n"], ["+", 9, "r"], ["-", 9, "p"], ["+", 10, "s"], ["+", 11, "t"]])

With PR's version we get this result (in a Jupyter notebook):

Screenshot 2024-05-02 at 12 54 19 PM

@lizmat lizmat merged commit e146870 into raku-community-modules:main May 2, 2024
3 checks passed
@lizmat
Copy link
Contributor

lizmat commented May 2, 2024

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants