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

.race.grep(...) and .hyper.grep(...) produce an empty sequence #4739

Closed
p6rt opened this issue Nov 9, 2015 · 11 comments
Closed

.race.grep(...) and .hyper.grep(...) produce an empty sequence #4739

p6rt opened this issue Nov 9, 2015 · 11 comments

Comments

@p6rt
Copy link

p6rt commented Nov 9, 2015

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

Searchable as RT126597$

@p6rt
Copy link
Author

p6rt commented Nov 9, 2015

From matt.oates@congenica.com

The following has an empty result when using race or hyper in perl6 version 2015.10-233-gac750a9 built on MoarVM version 2015.10-61-g624d504

$ perl6

(1..10).grep(* > 3)
(4 5 6 7 8 9 10)
(1..10).race().grep(* > 3)
()
(1..10).hyper().grep(* > 3)
()

Looks specifically like the methods after the hyper/race never get called​:

(1..10).hyper().grep(* > 3).map({$_.say; $_})
()
(1..10).map({$_.say; $_}).hyper().grep(* > 3)
1
2
3
4
5
6
7
8
9
10
()

@p6rt
Copy link
Author

p6rt commented Nov 26, 2015

From @Mouq

On Mon Nov 09 06​:36​:49 2015, matt.oates@​congenica.com wrote​:

The following has an empty result when using race or hyper in perl6
version 2015.10-233-gac750a9 built on MoarVM version 2015.10-61-
g624d504

$ perl6

(1..10).grep(* > 3)
(4 5 6 7 8 9 10)
(1..10).race().grep(* > 3)
()
(1..10).hyper().grep(* > 3)
()

Looks specifically like the methods after the hyper/race never get
called​:

(1..10).hyper().grep(* > 3).map({$_.say; $_})
()
(1..10).map({$_.say; $_}).hyper().grep(* > 3)
1
2
3
4
5
6
7
8
9
10
()

Another, probably related case is that maps on hyper work with with normal subroutines, but not multis​:

18​:47 < Quom_> Did anyone else notice this issue​:
18​:47 < Quom_> m​: sub f($a) {$a**2}; say [+] (^100).hyper.map(&f)
18​:47 <+camelia> rakudo-moar 51d695​: OUTPUT«328350␤»
18​:47 < Quom_> m​: multi f($a) {$a**2}; say [+] (^100).hyper.map(&f)
18​:47 <+camelia> rakudo-moar 51d695​: OUTPUT«0␤»
18​:47 < Quom_> m​: multi f($a) {$a**2}; say [+] (^100).map(&f)
18​:47 <+camelia> rakudo-moar 51d695​: OUTPUT«328350␤»
18​:48 < TimToady> I think we noticed something like it the other day, dunno if anybody rakudobugged it

@p6rt
Copy link
Author

p6rt commented Nov 26, 2015

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

@p6rt
Copy link
Author

p6rt commented Jan 6, 2016

From @AlexDaniel

Regular grep​:

<AlexDaniel> m​: say ^10 .grep​: *.is-prime
<camelia> rakudo-moar fec061​: OUTPUT«(2 3 5 7)␤»

With hyper​:

<AlexDaniel> m​: say ^10 .hyper.grep​: *.is-prime
<camelia> rakudo-moar fec061​: OUTPUT« it has 0 elements.␤()␤»

With race​:

<AlexDaniel> m​: say ^10 .race.grep​: *.is-prime
<camelia> rakudo-moar fec061​: OUTPUT« it has 0 elements.␤()␤»

More​:

<AlexDaniel> m​: my @​a = ^1000 .hyper.grep(* > 5); say @​a
<camelia> rakudo-moar fec061​: OUTPUT« it has 0 elements.␤ it has 0
  elements.␤ it has 0 elements.␤ it has 0
elements.␤ it has 0
  elements.␤ it has 0 elements.␤ it has 0
elements.␤ it has 0
  elements.␤ it has 0 elements.␤ it has 0
elements.␤ it has 0
  elem…»

What is this “it has 0 elements.” thing? Why do I see it? Why it returns an
empty list?

@p6rt
Copy link
Author

p6rt commented Jan 6, 2016

From @coke

On Wed Jan 06 06​:35​:15 2016, alex.jakimenko@​gmail.com wrote​:

Regular grep​:

<AlexDaniel> m​: say ^10 .grep​: *.is-prime
<camelia> rakudo-moar fec061​: OUTPUT«(2 3 5 7)␤»

With hyper​:

<AlexDaniel> m​: say ^10 .hyper.grep​: *.is-prime
<camelia> rakudo-moar fec061​: OUTPUT« it has 0 elements.␤()␤»

With race​:

<AlexDaniel> m​: say ^10 .race.grep​: *.is-prime
<camelia> rakudo-moar fec061​: OUTPUT« it has 0 elements.␤()␤»

More​:

<AlexDaniel> m​: my @​a = ^1000 .hyper.grep(* > 5); say @​a
<camelia> rakudo-moar fec061​: OUTPUT« it has 0 elements.␤ it has 0
elements.␤ it has 0 elements.␤ it has 0
elements.␤ it has 0
elements.␤ it has 0 elements.␤ it has 0
elements.␤ it has 0
elements.␤ it has 0 elements.␤ it has 0
elements.␤ it has 0
elem…»

What is this “it has 0 elements.” thing? Why do I see it? Why it returns an
empty list?

This was added by timo after Christmas; This debug output is the only thing in the conditional block it appears in.

$ git show 20c796cd
commit 20c796cd31e5148e2f8fd35aab4c7eca073696ca
Author​: Timo Paulssen <timonator@​perpetuum-immobile.de>
Date​: Thu Dec 31 03​:39​:49 2015 +0100

  hyper now cares about sequence numbers of work

  this code wants to get a bit cleaned up. i'm sure
  the control flow could be a bit less convoluted.

--
Will "Coke" Coleda

@p6rt
Copy link
Author

p6rt commented Jan 6, 2016

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

@p6rt
Copy link
Author

p6rt commented Jan 7, 2016

From @timo

I just kicked out the debug output, but sadly hyper + grep remains
broken. sadly, hyper + grep has been broken for a longer time :(

@p6rt
Copy link
Author

p6rt commented Jan 13, 2016

From alex.hartmaier@gmail.com

I've stumbled over this bug today too when using @​array.combinations(3).race.grep(&is-match).say.
Same when race is replaced by hyper.

@p6rt
Copy link
Author

p6rt commented May 6, 2016

From @smls

As another data-point, the problem only occurs when .grep is called directly on the HyperSeq returned by .hyper/.race, and not when a .map is interposed​:

  say (1..10).hyper().grep(* > 3); # ()
  say (1..10).hyper().map({$_}).grep(* > 3); # (4 5 6 7 8 9 10)

@p6rt
Copy link
Author

p6rt commented Oct 18, 2017

From @jnthn

On Mon, 09 Nov 2015 06​:36​:49 -0800, matt.oates@​congenica.com wrote​:

The following has an empty result when using race or hyper in perl6
version 2015.10-233-gac750a9 built on MoarVM version 2015.10-61-
g624d504

$ perl6

(1..10).grep(* > 3)
(4 5 6 7 8 9 10)
(1..10).race().grep(* > 3)
()
(1..10).hyper().grep(* > 3)
()

Looks specifically like the methods after the hyper/race never get
called​:

(1..10).hyper().grep(* > 3).map({$_.say; $_})
()
(1..10).map({$_.say; $_}).hyper().grep(* > 3)
1
2
3
4
5
6
7
8
9
10
()

Fixed in new hyper/race implementation; tests in S07-hyperrace/hyper.t and S07-hyperrace/race.t.

@p6rt
Copy link
Author

p6rt commented Oct 18, 2017

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

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