Skip to content

Instantly share code, notes, and snippets.

@MasterDuke17
Created March 11, 2018 13:16
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 MasterDuke17/86c7c0e294a33e026a2d7d29cec3d9e8 to your computer and use it in GitHub Desktop.
Save MasterDuke17/86c7c0e294a33e026a2d7d29cec3d9e8 to your computer and use it in GitHub Desktop.
diff --git a/src/core/List.pm6 b/src/core/List.pm6
index f098d294e..18b4bd7b6 100644
--- a/src/core/List.pm6
+++ b/src/core/List.pm6
@@ -1492,10 +1492,51 @@ my class List does Iterable does Positional { # declared in BOOTSTRAP
# The , operator produces a List.
proto sub infix:<,>(|) is pure {*}
multi sub infix:<,>() { nqp::create(List) }
-multi sub infix:<,>(Int \a, Int \b) is default {
- nqp::p6bindattrinvres(nqp::create(List),List,'$!reified',nqp::list(a,b))
+multi sub infix:<,>(Slip:D \a, Slip:D \b) {
+ nqp::stmts(
+ (my $reified := nqp::create(IterationBuffer)),
+ # now set up the List with a future
+ (my $list :=
+ nqp::p6bindattrinvres(nqp::create(List),List,'$!reified',$reified)),
+ nqp::bindattr($list,List,'$!todo',
+ my $todo:= nqp::create(List::Reifier)),
+ nqp::bindattr($todo,List::Reifier,'$!reified',$reified),
+ nqp::bindattr($todo,List::Reifier,'$!future',nqp::list(a,b)),
+ nqp::bindattr($todo,List::Reifier,'$!reification-target',$reified),
+ $list
+ )
+}
+multi sub infix:<,>(Any \a, Slip:D \b) {
+ nqp::stmts( # Slip seen, first copy non-slippy things
+ (my $reified := nqp::setelems(nqp::create(IterationBuffer),1)),
+ nqp::bindpos($reified,0,a),
+ # now set up the List with a future
+ (my $list :=
+ nqp::p6bindattrinvres(nqp::create(List),List,'$!reified',$reified)),
+ nqp::bindattr($list,List,'$!todo',
+ my $todo:= nqp::create(List::Reifier)),
+ nqp::bindattr($todo,List::Reifier,'$!reified',$reified),
+ nqp::bindattr($todo,List::Reifier,'$!future',nqp::list(b)),
+ nqp::bindattr($todo,List::Reifier,'$!reification-target',$reified),
+ $list
+ )
+}
+multi sub infix:<,>(Slip:D \a, Any \b) {
+ nqp::stmts( # Slip seen, first copy non-slippy things
+ (my $reified := nqp::setelems(nqp::create(IterationBuffer),1)),
+ nqp::bindpos($reified,1,b),
+ # now set up the List with a future
+ (my $list :=
+ nqp::p6bindattrinvres(nqp::create(List),List,'$!reified',$reified)),
+ nqp::bindattr($list,List,'$!todo',
+ my $todo:= nqp::create(List::Reifier)),
+ nqp::bindattr($todo,List::Reifier,'$!reified',$reified),
+ nqp::bindattr($todo,List::Reifier,'$!future',nqp::list(a)),
+ nqp::bindattr($todo,List::Reifier,'$!reification-target',$reified),
+ $list
+ )
}
-multi sub infix:<,>(Str \a, Str \b) {
+multi sub infix:<,>(Any \a, Any \b) {
nqp::p6bindattrinvres(nqp::create(List),List,'$!reified',nqp::list(a,b))
}
multi sub infix:<,>(|) {
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment