Skip to content
Permalink
Browse files

make nativecall's `postcircumfix:<[ ]>` return containers

so that you can `$my-carray[0]++` for example
  • Loading branch information...
timo committed Oct 6, 2018
1 parent 687a3cb commit be2d4cb4b301bb5666761257cac8b2ef1dc301b7
Showing with 3 additions and 3 deletions.
  1. +3 −3 lib/NativeCall.pm6
@@ -582,13 +582,13 @@ our role Native[Routine $r, $libname where Str|Callable|List|IO::Path|Distributi
}
}

multi sub postcircumfix:<[ ]>(CArray:D \array, $pos) is export(:DEFAULT, :types) is default {
multi sub postcircumfix:<[ ]>(CArray:D \array, $pos) is raw is export(:DEFAULT, :types) is default {
$pos ~~ Iterable ?? $pos.map: { array.AT-POS($_) } !! array.AT-POS($pos);
}
multi sub postcircumfix:<[ ]>(CArray:D \array, *@pos) is export(:DEFAULT, :types) {
multi sub postcircumfix:<[ ]>(CArray:D \array, *@pos) is raw is export(:DEFAULT, :types) {
@pos.map: { array.AT-POS($_) };
}
multi sub postcircumfix:<[ ]>(CArray:D \array, Callable:D $block) is export(:DEFAULT, :types) {
multi sub postcircumfix:<[ ]>(CArray:D \array, Callable:D $block) is raw is export(:DEFAULT, :types) {
nqp::stmts(
(my $*INDEX = 'Effective index'),
array[$block.pos(array)]

0 comments on commit be2d4cb

Please sign in to comment.
You can’t perform that action at this time.