Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
- create a separate List:D source candidate that can use nqp::atpos - also for native str and num
- Loading branch information
Showing
2 changed files
with
75 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -83,14 +83,29 @@ for $*IN.lines -> $line { | |
nqp::setelems(self,nqp::elems(values)); | ||
nqp::splice(self,values,0,nqp::elems(values)) | ||
} | ||
multi method STORE(#type#array:D: List:D \values) { | ||
my int $elems = values.elems; # reifies | ||
my $reified := nqp::getattr(values,List,'$!reified'); | ||
nqp::setelems(self, $elems); | ||
my int $i = -1; | ||
nqp::while( | ||
nqp::islt_i(($i = nqp::add_i($i,1)),$elems), | ||
nqp::bindpos_#postfix#(self, $i, | ||
nqp::unbox_#postfix#(nqp::atpos($reified,$i))) | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
lizmat
Author
Contributor
|
||
); | ||
self | ||
} | ||
multi method STORE(#type#array:D: @values) { | ||
my int $elems = @values.elems; | ||
nqp::setelems(self, $elems); | ||
my int $i = -1; | ||
nqp::bindpos_#postfix#(self, $i, | ||
nqp::unbox_#postfix#(@values.AT-POS($i))) | ||
while nqp::islt_i($i = nqp::add_i($i,1),$elems); | ||
nqp::while( | ||
nqp::islt_i(($i = nqp::add_i($i,1)),$elems), | ||
nqp::bindpos_#postfix#(self, $i, | ||
nqp::unbox_#postfix#(@values.AT-POS($i))) | ||
); | ||
self | ||
} | ||
|
Could the
nqp::atpos
benqp::atpos_#postfix#
?