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

cross operator doesn't always thunk left side where it should #6005

Open
p6rt opened this issue Jan 16, 2017 · 3 comments
Open

cross operator doesn't always thunk left side where it should #6005

p6rt opened this issue Jan 16, 2017 · 3 comments

Comments

@p6rt
Copy link

p6rt commented Jan 16, 2017

Migrated from rt.perl.org#130565 (status was 'open')

Searchable as RT130565$

@p6rt
Copy link
Author

p6rt commented Jan 16, 2017

From @b2gills

  say Bool.pick Xxx ^5

will only ever output one of these two results

  (() (True) (True True) (True True True) (True True True True))
  (() (False) (False False) (False False False) (False False False False))

If you place the left side in a list it does work

  say (Bool.pick,) Xxx ^5
  (() (True) (False True) (False True False) (True True False True))

First came to my attention with this commit rakudo/rakudo@a26f51361b
As far as I know it has never worked though

The infix​:<xx> operator has a thunky of 't.', and that code in the commit is looking for a thunky of '.t' or '.b' etc

infix​:<&&> has a thunky of '.t' and infix​:<xor> has a thunky of '.b'

A proper test would be something like the following

  my $count = 0;
  is-deeply ($count++ Xxx ^5).list, ((),(0,),(1,2),(3,4,5),(6,7,8,9));
  is $count, 10;

@p6rt
Copy link
Author

p6rt commented Jan 17, 2017

From @smls

Also observable with ||​:

  ➜ say <0 0 0 0 0 0 0> X|| $++;
  (0 0 0 0 0 0 0)
 
  ➜ say <0 0 0 0 0 0 0> X|| ($++,);
  (0 1 2 3 4 5 6)

@p6rt
Copy link
Author

p6rt commented Jan 17, 2017

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

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

No branches or pull requests

1 participant