Raku / old-issue-tracker

Tickets from RT
https://github.com/Raku/old-issue-tracker/issues
2 stars 1 forks source link

Wrong set difference of Bag and List #6679

Closed p6rt closed 5 years ago

p6rt commented 6 years ago

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

Searchable as RT133016$

p6rt commented 6 years ago

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(\) (+) bag(\); # Bag(a(3), b)   say bag(\) (+) \; # Bag(a(3), b)   say \ (+) bag(\); # Bag(a(3), b)

  say bag(\) (-) bag(\); # Bag(a, b)   say bag(\) (-) \; # Bag(a(2), b) seems wrong   say \ (-) bag(\); # 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 commented 6 years ago

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 commented 6 years ago

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

p6rt commented 6 years ago

From @AlexDaniel

FWIW bisectable points to (2017-06-25) https://github.com/rakudo/rakudo/commit/a2133dbc6a00d1f87bb0644c829591144381d736

( 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(\) (+) bag(\); # Bag(a(3), b) say bag(\) (+) \; # Bag(a(3), b) say \ (+) bag(\); # Bag(a(3), b)

say bag(\) (-) bag(\); # Bag(a, b) say bag(\) (-) \; # Bag(a(2), b) seems wrong say \ (-) bag(\); # 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 commented 6 years ago

From @lizmat

Fixed with 344a64e987 , tests needed

On 24 Mar 2018, at 15​:01, Aleks-Daniel Jakimenko-Aleksejev via RT \perl6\-bugs\-followup@&#8203;perl\.org wrote​:

FWIW bisectable points to (2017-06-25) https://github.com/rakudo/rakudo/commit/a2133dbc6a00d1f87bb0644c829591144381d736

( 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(\) (+) bag(\); # Bag(a(3), b) say bag(\) (+) \; # Bag(a(3), b) say \ (+) bag(\); # Bag(a(3), b)

say bag(\) (-) bag(\); # Bag(a, b) say bag(\) (-) \; # Bag(a(2), b) seems wrong say \ (-) bag(\); # 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 commented 5 years ago

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@&#8203;perl\.org wrote​:

FWIW bisectable points to (2017-06-25) https://github.com/rakudo/rakudo/commit/a2133dbc6a00d1f87bb0644c829591144381d736

( 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(\) (+) bag(\); # Bag(a(3), b) say bag(\) (+) \; # Bag(a(3), b) say \ (+) bag(\); # Bag(a(3), b)

say bag(\) (-) bag(\); # Bag(a, b) say bag(\) (-) \; # Bag(a(2), b) seems wrong say \ (-) bag(\); # 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 https://github.com/perl6/roast/commit/2288d4a3c543d72f822164dad529066ed055a0aa

p6rt commented 5 years ago

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