I am trying to obtain the umptieth element of an array:
my @lazy-array = lazy 1, 11, 121 ... 10**100;
say @lazy-array[10**50];
This yields
Cannot unbox 167 bit wide bigint into native integer
Same problem if I assign it to a variable. This does not seem to be reflected in the documentation, and wonder if it's a feature or a bug. Also, what would be the correct way of acessing those positions (other than iterating)
In the current implementation in Raku, which is based on NQP, array indexes have a maximum of 63 bits (at least on 64bit builds).
use nqp;
my $l := nqp::list;
dd nqp::atpos($l,0x7fff_ffff_ffff_ffff); # Mu
dd nqp::atpos($l,0x7fff_ffff_ffff_ffff + 1);
# Cannot unbox 64 bit wide bigint into native integer
I would not consider it a feature or a bug, but a limitation of the current implementation.
Please note that you could use Array::Sparse if you want to use larger indexes.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With