Skip to content

Instantly share code, notes, and snippets.

@jnthn
Created July 9, 2013 19:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jnthn/5960231 to your computer and use it in GitHub Desktop.
Save jnthn/5960231 to your computer and use it in GitHub Desktop.
diff --git a/src/core/Any.pm b/src/core/Any.pm
index 002309b..fb439ad 100644
--- a/src/core/Any.pm
+++ b/src/core/Any.pm
@@ -48,6 +48,9 @@ my class Any {
my $list = (self,).flat.eager;
my Mu $rsa := nqp::list_s();
$list.gimme(4); # force reification of at least 4 elements
+ unless $list.infinite {
+ nqp::setelems($rsa, nqp::unbox_i($list.elems));
+ }
nqp::push_s($rsa, nqp::unbox_s($list.shift.Stringy))
while $list.gimme(0);
nqp::push_s($rsa, '...') if $list.infinite;
diff --git a/src/core/Any.pm b/src/core/Any.pm
index 002309b..a43deeb 100644
--- a/src/core/Any.pm
+++ b/src/core/Any.pm
@@ -48,8 +48,11 @@ my class Any {
my $list = (self,).flat.eager;
my Mu $rsa := nqp::list_s();
$list.gimme(4); # force reification of at least 4 elements
- nqp::push_s($rsa, nqp::unbox_s($list.shift.Stringy))
- while $list.gimme(0);
+ my $tmp;
+ while $list.gimme(0) {
+ $tmp := $list.shift;
+ nqp::push_s($rsa, nqp::unbox_s(nqp::istype($tmp, Str) ?? $tmp !! $tmp.Str))
+ }
nqp::push_s($rsa, '...') if $list.infinite;
nqp::p6box_s(nqp::join(nqp::unbox_s($separator.Stringy), $rsa))
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment