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

Inconsistency with non-int $k in “combinations” (combinations 2, 0.5) #5197

Closed
p6rt opened this issue Mar 24, 2016 · 6 comments
Closed

Comments

@p6rt
Copy link

p6rt commented Mar 24, 2016

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

Searchable as RT127779$

@p6rt
Copy link
Author

p6rt commented Mar 24, 2016

From @AlexDaniel

Code​:
say combinations 2, 0.5

Result​:
(())

Code​:
say combinations 2, 1.5

Result​:
This type cannot unbox to a native integer
  in block <unit> at -e line 1

These results are inconsistent. 0.5 cannot be unboxed to a native int too, but it is accepted. I think that both should result in the same error.

@p6rt
Copy link
Author

p6rt commented Apr 11, 2016

From @usev6

The implementation has changed with rakudo commit f220a5ed so that Int() is called on $k (and $n).

The examples work consistently now, but it looks like there are no tests for this in roast​:

$ perl6-m -e 'say combinations 2, 0.5'
(())

$ perl6-m -e 'say combinations 2, 1.5'
((0) (1))

$ perl6-m -e 'say combinations 4, 2.5'
((0 1) (0 2) (0 3) (1 2) (1 3) (2 3))

1 similar comment
@p6rt
Copy link
Author

p6rt commented Apr 11, 2016

From @usev6

The implementation has changed with rakudo commit f220a5ed so that Int() is called on $k (and $n).

The examples work consistently now, but it looks like there are no tests for this in roast​:

$ perl6-m -e 'say combinations 2, 0.5'
(())

$ perl6-m -e 'say combinations 2, 1.5'
((0) (1))

$ perl6-m -e 'say combinations 4, 2.5'
((0 1) (0 2) (0 3) (1 2) (1 3) (2 3))

@p6rt
Copy link
Author

p6rt commented Apr 11, 2016

@usev6 - Status changed from 'new' to 'open'

@p6rt
Copy link
Author

p6rt commented Jul 4, 2016

From @zoffixznet

Tests added​: Raku/roast@0ff33b312b

@p6rt
Copy link
Author

p6rt commented Jul 4, 2016

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

@p6rt p6rt closed this as completed Jul 4, 2016
@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