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

Wrong set difference of Bag and List #6679

Closed
p6rt opened this issue Mar 23, 2018 · 7 comments
Closed

Wrong set difference of Bag and List #6679

p6rt opened this issue Mar 23, 2018 · 7 comments

Comments

@p6rt
Copy link

p6rt commented Mar 23, 2018

Migrated from rt.perl.org#133016 (status was 'resolved')

Searchable as RT133016$

@p6rt
Copy link
Author

p6rt commented Mar 23, 2018

From @nwellnhof

I get an unexpected result when subtracting a List from a Bag with the set
difference operator (-). Subtracting Bags from Lists or Bags works fine, as
does the baggy addition operator​:

  say bag(<a b>) (+) bag(<a a>); # Bag(a(3), b)
  say bag(<a b>) (+) <a a>; # Bag(a(3), b)
  say <a b> (+) bag(<a a>); # Bag(a(3), b)

  say bag(<a a a b>) (-) bag(<a a>); # Bag(a, b)
  say bag(<a a a b>) (-) <a a>; # Bag(a(2), b) seems wrong
  say <a a a b> (-) bag(<a a>); # Bag(a, b)

Only tested online on tio.run

  Rakudo version 2017.12 built on MoarVM version 2017.12
  implementing Perl 6.c.

and code-golf.io​:

  Rakudo version 2018.03 built on MoarVM version 2018.03
  implementing Perl 6.c

Nick

@p6rt
Copy link
Author

p6rt commented Mar 24, 2018

From @lizmat

That does indeed look wrong to me, investigating

On 23 Mar 2018, at 15​:04, Nick Wellnhofer (via RT) <perl6-bugs-followup@​perl.org> wrote​:

# New Ticket Created by Nick Wellnhofer
# Please include the string​: [perl #​133016]
# in the subject line of all future correspondence about this issue.
# <URL​: https://rt-archive.perl.org/perl6/Ticket/Display.html?id=133016 >

I get an unexpected result when subtracting a List from a Bag with the set
difference operator (-). Subtracting Bags from Lists or Bags works fine, as
does the baggy addition operator​:

say bag\(\<a b>\) \(\+\) bag\(\<a a>\);      \# Bag\(a\(3\), b\)
say bag\(\<a b>\) \(\+\) \<a a>;           \# Bag\(a\(3\), b\)
say      \<a b> \(\+\) bag\(\<a a>\);      \# Bag\(a\(3\), b\)

say bag\(\<a a a b>\) \(\-\) bag\(\<a a>\);  \# Bag\(a, b\)
say bag\(\<a a a b>\) \(\-\) \<a a>;       \# Bag\(a\(2\), b\) seems wrong
say      \<a a a b> \(\-\) bag\(\<a a>\);  \# Bag\(a, b\)

Only tested online on tio.run

Rakudo version 2017\.12 built on MoarVM version 2017\.12
implementing Perl 6\.c\.

and code-golf.io​:

Rakudo version 2018\.03 built on MoarVM version 2018\.03
implementing Perl 6\.c

Nick

@p6rt
Copy link
Author

p6rt commented Mar 24, 2018

The RT System itself - Status changed from 'new' to 'open'

@p6rt
Copy link
Author

p6rt commented Mar 24, 2018

From @AlexDaniel

FWIW bisectable points to (2017-06-25) rakudo/rakudo@a2133db

( before that it was giving bag(a, b) or bag(b, a) )

On 2018-03-24 01​:43​:59, elizabeth wrote​:

That does indeed look wrong to me, investigating

On 23 Mar 2018, at 15​:04, Nick Wellnhofer (via RT) <perl6-bugs-
followup@​perl.org> wrote​:

# New Ticket Created by Nick Wellnhofer
# Please include the string​: [perl #​133016]
# in the subject line of all future correspondence about this issue.
# <URL​: https://rt-archive.perl.org/perl6/Ticket/Display.html?id=133016 >

I get an unexpected result when subtracting a List from a Bag with
the set
difference operator (-). Subtracting Bags from Lists or Bags works
fine, as
does the baggy addition operator​:

say bag(<a b>) (+) bag(<a a>); # Bag(a(3), b)
say bag(<a b>) (+) <a a>; # Bag(a(3), b)
say <a b> (+) bag(<a a>); # Bag(a(3), b)

say bag(<a a a b>) (-) bag(<a a>); # Bag(a, b)
say bag(<a a a b>) (-) <a a>; # Bag(a(2), b) seems wrong
say <a a a b> (-) bag(<a a>); # Bag(a, b)

Only tested online on tio.run

Rakudo version 2017.12 built on MoarVM version 2017.12
implementing Perl 6.c.

and code-golf.io​:

Rakudo version 2018.03 built on MoarVM version 2018.03
implementing Perl 6.c

Nick

@p6rt
Copy link
Author

p6rt commented Apr 12, 2018

From @lizmat

Fixed with 344a64e987 , tests needed

On 24 Mar 2018, at 15​:01, Aleks-Daniel Jakimenko-Aleksejev via RT <perl6-bugs-followup@​perl.org> wrote​:

FWIW bisectable points to (2017-06-25)
rakudo/rakudo@a2133db

( before that it was giving bag(a, b) or bag(b, a) )

On 2018-03-24 01​:43​:59, elizabeth wrote​:

That does indeed look wrong to me, investigating

On 23 Mar 2018, at 15​:04, Nick Wellnhofer (via RT) <perl6-bugs-
followup@​perl.org> wrote​:

# New Ticket Created by Nick Wellnhofer
# Please include the string​: [perl #​133016]
# in the subject line of all future correspondence about this issue.
# <URL​: https://rt-archive.perl.org/perl6/Ticket/Display.html?id=133016 >

I get an unexpected result when subtracting a List from a Bag with
the set
difference operator (-). Subtracting Bags from Lists or Bags works
fine, as
does the baggy addition operator​:

say bag(<a b>) (+) bag(<a a>); # Bag(a(3), b)
say bag(<a b>) (+) <a a>; # Bag(a(3), b)
say <a b> (+) bag(<a a>); # Bag(a(3), b)

say bag(<a a a b>) (-) bag(<a a>); # Bag(a, b)
say bag(<a a a b>) (-) <a a>; # Bag(a(2), b) seems wrong
say <a a a b> (-) bag(<a a>); # Bag(a, b)

Only tested online on tio.run

Rakudo version 2017.12 built on MoarVM version 2017.12
implementing Perl 6.c.

and code-golf.io​:

Rakudo version 2018.03 built on MoarVM version 2018.03
implementing Perl 6.c

Nick

@p6rt
Copy link
Author

p6rt commented Jun 23, 2018

From @dogbert17

On Thu, 12 Apr 2018 07​:21​:53 -0700, elizabeth wrote​:

Fixed with 344a64e987 , tests needed

On 24 Mar 2018, at 15​:01, Aleks-Daniel Jakimenko-Aleksejev via RT
<perl6-bugs-followup@​perl.org> wrote​:

FWIW bisectable points to (2017-06-25)
rakudo/rakudo@a2133db

( before that it was giving bag(a, b) or bag(b, a) )

On 2018-03-24 01​:43​:59, elizabeth wrote​:

That does indeed look wrong to me, investigating

On 23 Mar 2018, at 15​:04, Nick Wellnhofer (via RT) <perl6-bugs-
followup@​perl.org> wrote​:

# New Ticket Created by Nick Wellnhofer
# Please include the string​: [perl #​133016]
# in the subject line of all future correspondence about this
issue.
# <URL​: https://rt-archive.perl.org/perl6/Ticket/Display.html?id=133016 >

I get an unexpected result when subtracting a List from a Bag with
the set
difference operator (-). Subtracting Bags from Lists or Bags works
fine, as
does the baggy addition operator​:

say bag(<a b>) (+) bag(<a a>); # Bag(a(3), b)
say bag(<a b>) (+) <a a>; # Bag(a(3), b)
say <a b> (+) bag(<a a>); # Bag(a(3), b)

say bag(<a a a b>) (-) bag(<a a>); # Bag(a, b)
say bag(<a a a b>) (-) <a a>; # Bag(a(2), b) seems wrong
say <a a a b> (-) bag(<a a>); # Bag(a, b)

Only tested online on tio.run

Rakudo version 2017.12 built on MoarVM version 2017.12
implementing Perl 6.c.

and code-golf.io​:

Rakudo version 2018.03 built on MoarVM version 2018.03
implementing Perl 6.c

Nick

Test added in Roast commit Raku/roast@2288d4a

@p6rt p6rt closed this as completed Jun 23, 2018
@p6rt
Copy link
Author

p6rt commented Jun 23, 2018

@dogbert17 - Status changed from 'open' to 'resolved'

@p6rt p6rt added the testneeded label Jan 5, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant